返回列表 發帖
本帖最後由 吳侑諶 於 2024-9-20 19:34 編輯
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. int main()
  4. {
  5.     for(int t=0; t<3; t++)
  6.     {
  7.         string str;
  8.         int n[5];
  9.         getline(cin, str);
  10.         for(int i=0; i<5; i++)
  11.             n[i]=str[i]-'0';
  12.         int res=(n[0]+n[2]+n[4]+(n[1]+n[3])*5)%26;
  13.         if(res==str[5]-'A'+1)
  14.             cout<<"Pass"<<endl;
  15.         else
  16.             cout<<"Fail"<<endl;
  17.     }
  18.     return 0;
  19. }
複製代碼

TOP

返回列表