求助P1055
  • 板块灌水区
  • 楼主GeorgeCanFound
  • 当前回复16
  • 已保存回复16
  • 发布时间2022/10/16 19:49
  • 上次更新2023/10/27 07:12:56
查看原帖
求助P1055
568971
GeorgeCanFound楼主2022/10/16 19:49

rt

#include <bits/stdc++.h>

using namespace std;

int main()
{
    bool language;
    int num , publish , right_check_code = 0;
    char ch , check_code;
    string s;
    cin >> language >> ch >> publish >> ch >> num >> ch >> check_code;
    s = to_string( language );
    s += to_string( publish );
    s += to_string( num );
    for( int i = 0 ; i < s.length() ; ++i )
        right_check_code += ( s[i] - '0' ) * ( i + 1 );
    right_check_code %= 11;
    if( right_check_code == check_code - '0' || ( right_check_code == 10 && check_code == 'X' ) )
        cout << "Right" << endl;
    else if( right_check_code != 10 )
        cout << setfill('0') << language << ch << setw(3) << publish << ch << setw(5) << num << ch << right_check_code << endl;
    else
        cout << setfill('0') << language << ch << setw(3) << publish << ch << setw(5) << num << ch << 'X' << endl;
    return 0;
}
2022/10/16 19:49
加载中...