結果
| 問題 |
No.432 占い(Easy)
|
| コンテスト | |
| ユーザー |
Kmcode1
|
| 提出日時 | 2016-10-14 22:24:35 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 6 ms / 2,000 ms |
| コード長 | 512 bytes |
| コンパイル時間 | 1,473 ms |
| コンパイル使用メモリ | 163,280 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-11-22 07:07:44 |
| 合計ジャッジ時間 | 2,373 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 22 |
コンパイルメッセージ
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);
| ~~~~~^~~~~~~~~~~
ソースコード
#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();
}
printf("%d\n", v[0]);
}
return 0;
}
Kmcode1