Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
7003 | 邓小龙 | 百钱买百鸡II | C++ | Accepted | 1 MS | 256 KB | 668 | 2025-03-29 15:36:00 |
#include<iostream> // cin\cout\endl #include<cstdio> //scanf()\printf() #include<cstring> // strcpy()\strcat()\strcmp()\strlen()\memset() #include<cmath> //sqrt()\pow()\abs()\ceil()\floor()\max()\min() using namespace std; int main(){ int g,m,x,q,cnt=0,k=0; cin>>q; //穷举所有种类的鸡的数量 for(g=0;g<=q/5;g++){ for(m=0;m<=q/3;m++){ x=q-g-m; //k++; if( g+m+x==q && 5*g+3*m+x/3==q &&x%3==0){ cout<<++cnt<<": "<<g<<","<<m<<","<<x<<endl; } } } if(cnt==0)cout<<"None"<<endl; //cout<<k<<endl; return 0; }