1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
| #include <bits/stdc++.h> using namespace std; int n,m,ans[55]; string s; int main(){ ios::sync_with_stdio(false); cin>>n>>m>>s; for (int i=0;i<m;i++)ans[i]=s[i]-'A'; while (n--){ double cnt=0; int kh=0; cin>>s; for (int i=15;i>=0;i--)kh+=(s[i]-'0')*pow(2,15-i); bool khzq=kh>=1&&kh<=10000; if (!khzq){ for (int i=0;i<=m;i++)cin>>s; printf ("Wrong ID\n\n");continue; } cin>>s; if (s[0]==s[1])s[kh&1]='0'; printf ("ID: %d\nType %s\n",kh,s[kh&1]-'0'?"Correct":"Incorrect"); for (int i=0;i<m;i++){ cin>>s; bool ok=0,f=0; for (int j=0;j<4;j++)if (s[j]-'0'&&ok)f=1; else if (s[j]-'0')ok=1; if (ok&&!f&&s[ans[i]]-'0')cnt+=100.0/m; } printf ("%.1f\n\n",cnt); } return 0; }
|