Run ID 作者 问题 语言 测评结果 分数 时间 内存 代码长度 提交时间
33098 林芳菲 【J】T2 C++ 通过 100 2 MS 476 KB 529 2024-10-04 14:16:45

Tests(10/10):


#include <cstdio> #include <iostream> #include <algorithm> using namespace std; string n; int main() { cin >> n; if (n.size() == 1) { cout << "9" << endl; return 0; } int k = n[0] - '0'; n[0] = '9'; for (int i = 1; i < n.size(); i++) { int w = n[i] - '0'; w = (w + 9 - k) % 10; n[i] = w + '0'; } int c = 1; while (c < n.size() && n[c] == '9') c++; if (c < n.size()) n[c]++; cout << n << endl; return 0; }


测评信息: