From 7c6eabc9930cfec1a45fbabecc3179eaa4dec7ba Mon Sep 17 00:00:00 2001 From: Ren Baoshuo Date: Sun, 21 Nov 2021 15:28:42 +0800 Subject: [PATCH] =?UTF-8?q?P1055=20[NOIP2008=20=E6=99=AE=E5=8F=8A=E7=BB=84?= =?UTF-8?q?]=20ISBN=20=E5=8F=B7=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit R63275520 --- Luogu/P1055/P1055.cpp | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 Luogu/P1055/P1055.cpp diff --git a/Luogu/P1055/P1055.cpp b/Luogu/P1055/P1055.cpp new file mode 100644 index 00000000..73f0e3e2 --- /dev/null +++ b/Luogu/P1055/P1055.cpp @@ -0,0 +1,24 @@ +#include + +using namespace std; + +const char mod[] = "0123456789X"; + +int t; +string s; + +int main() { + cin >> s; + for (int i = 0, j = 0; i < 12; i++) { + if (s[i] != '-') { + t += (s[i] - '0') * ++j; + } + } + if (s[12] != mod[t % 11]) { + s[12] = mod[t % 11]; + cout << s << endl; + } else { + cout << "Right" << endl; + } + return 0; +}