Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
120582 翁思宸 18排列骨头 C++ Wrong Answer 0 MS 260 KB 2298 2025-05-30 19:48:35

Tests(0/1):


Code:

/* //1400 18患病人数占总患病人数的比例 #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(){ double a[101],n,a_18=0,a_35=0,a_60=0,up_61=0; cin>>n; for(int i=1;i<=n;i++){ cin>>a[i]; } for(int i=1;i<=n;i++){ if(a[i]>=0 && a[i]<=18){ a_18++; } else if(a[i]>=19 && a[i]<=35){ a_35++; } else if(a[i]>=36 && a[i]<=60){ a_60++; } else if(a[i]>=61){ up_61++; } } a_18=a_18/n*100; a_35=a_35/n*100; a_60=a_60/n*100; up_61=up_61/n*100; printf("%.2lf%%\n%.2lf%%\n%.2lf%%\n%.2lf%%\n",a_18,a_35,a_60,up_61); return 0; } //1401 18查找该数出现的位置 #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 a[2001],n,s,q,h,f=0; cin>>n; for(int i=1;i<=n;i++){ cin>>a[i]; } cin>>s; for(int i=1;i<=n;i++){ if(a[i]==s){ q=i; f=1; break; } } for(int i=n;i>=1;i--){ if(f==1 && a[i]==s){ h=i; break; } } if(f==1){ cout<<q<<" "<<h; } else{ cout<<"-1"; } return 0; }*/ //1402 18排列骨头 #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 a[31]={0},hu=0,cut=0,i; for(i=1;hu<15;i++){ if(i>30){ i=1; } if(a[i]==0){ cut++; } if(cut==9){ hu++; a[i]=1; cut=0; } } for(i=1;i<=31;i++){ if(a[i]==0){ cout<<i<<" "; } } return 0; }


Run Info:

------Input------
0
------Answer-----
1 2 3 4 10 11 13 14 15 17 20 21 25 28 29
------Your output-----
1 2 3 4 10 11 13 14 15 17 20 21 25 28 29 31