結果

問題 No.434 占い
ユーザー Kmcode1Kmcode1
提出日時 2016-10-14 23:07:07
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 661 bytes
コンパイル時間 1,454 ms
コンパイル使用メモリ 162,800 KB
実行使用メモリ 13,756 KB
最終ジャッジ日時 2024-05-02 00:55:11
合計ジャッジ時間 5,889 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
13,756 KB
testcase_01 AC 2 ms
6,940 KB
testcase_02 AC 2 ms
6,940 KB
testcase_03 AC 2 ms
6,940 KB
testcase_04 AC 2 ms
6,940 KB
testcase_05 WA -
testcase_06 AC 1 ms
6,944 KB
testcase_07 WA -
testcase_08 AC 327 ms
6,940 KB
testcase_09 AC 37 ms
6,940 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 3 ms
6,940 KB
testcase_13 AC 301 ms
6,940 KB
testcase_14 AC 37 ms
6,940 KB
testcase_15 TLE -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:13:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   13 |                 scanf("%s", buf);
      |                 ~~~~~^~~~~~~~~~~

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int t;

char buf[100002];

vector<int> v;

int main(){
	cin >> t;
	while (t--){
		scanf("%s", buf);
		v.clear();
		int siz = strlen(buf);
		for (int i = 0; i < siz; i++){
			v.push_back(buf[i] - '0');
		}
		while (v.size()>1){
			vector<int> tmp;
			for (int i = 0; i + 1 < v.size(); i++){
				int F = v[i] + v[i + 1];
				if (F >= 10){
					F %= 10;
					F++;
				}
				tmp.push_back(F);
			}
			v = tmp;
			tmp.clear();
			int k = v[0];
			bool ng = false;
			for (int i = 0; i < v.size(); i++){
				if (v[i] != k){
					ng = true;
				}
			}
			if (ng == false)break;
		}
		printf("%d\n", v[0]);
	}
	return 0;
}
0