提出 #24459496


ソースコード 拡げる

#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
//#pragma GCC optimize ("-O3")
using namespace std;
void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
template<class T>bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }
//---------------------------------------------------------------------------------------------------
/*---------------------------------------------------------------------------------------------------
            ∧_∧
      ∧_∧  (´<_` )  Welcome to My Coding Space!
     ( ´_ゝ`) /  ⌒i     @hamayanhamayan0
    /   \     | |
    /   / ̄ ̄ ̄ ̄/  |
  __(__ニつ/     _/ .| .|____
     \/____/ (u ⊃
---------------------------------------------------------------------------------------------------*/














string S;
//---------------------------------------------------------------------------------------------------
void _main() {
	cin >> S;

	int tot = 0;
	rep(i, 0, 14) if (i % 2 == 0) tot += S[i] - '0';
	tot *= 3;
	rep(i, 0, 14) if (i % 2 == 1) tot += S[i] - '0';

	if (S[14] - '0' == tot % 10) cout << "Yes" << endl;
	else cout << "No" << endl;
}





提出情報

提出日時
問題 A - チェックディジット
ユーザ hamayanhamayan
言語 C++ (GCC 9.2.1)
得点 9
コード長 1649 Byte
結果 AC
実行時間 13 ms
メモリ 3616 KiB

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 9 / 9
結果
AC × 2
AC × 9
セット名 テストケース
Sample example0.txt, example1.txt
All 000.txt, 001.txt, 002.txt, 003.txt, 004.txt, 005.txt, 006.txt, example0.txt, example1.txt
ケース名 結果 実行時間 メモリ
000.txt AC 13 ms 3464 KiB
001.txt AC 2 ms 3504 KiB
002.txt AC 2 ms 3468 KiB
003.txt AC 2 ms 3512 KiB
004.txt AC 2 ms 3468 KiB
005.txt AC 2 ms 3616 KiB
006.txt AC 2 ms 3592 KiB
example0.txt AC 2 ms 3616 KiB
example1.txt AC 2 ms 3492 KiB