結果
| 問題 |
No.432 占い(Easy)
|
| コンテスト | |
| ユーザー |
tottoripaper
|
| 提出日時 | 2016-10-14 22:28:56 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 11 ms / 2,000 ms |
| コード長 | 787 bytes |
| コンパイル時間 | 1,342 ms |
| コンパイル使用メモリ | 157,796 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-11-22 07:11:57 |
| 合計ジャッジ時間 | 2,251 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 22 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:19:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
19 | scanf("%d", &T);
| ~~~~~^~~~~~~~~~
main.cpp:22:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
22 | scanf("%s", S);
| ~~~~~^~~~~~~~~
ソースコード
#include <bits/stdc++.h>
using namespace std;
#define fst(t) std::get<0>(t)
#define snd(t) std::get<1>(t)
#define thd(t) std::get<2>(t)
using ll = long long;
using P = std::tuple<int,int>;
const int dx[8] = {-1, 1, 0, 0, -1, -1, 1, 1}, dy[8] = {0, 0, -1, 1, -1, 1, -1, 1};
char S[10000];
int arr[10000], arr2[10000];
int main(){
int T;
scanf("%d", &T);
for(int i=0;i<T;++i){
scanf("%s", S);
int l = strlen(S);
for(int j=0;j<l;++j){
arr[j] = S[j] - '0';
}
for(int j=l;j>1;--j){
for(int k=0;k+1<j;++k){
arr2[k] = arr[k] + arr[k+1];
arr2[k] = arr2[k] % 10 + arr2[k] / 10;
}
swap(arr, arr2);
}
printf("%d\n", arr[0]);
}
}
tottoripaper