結果
| 問題 |
No.432 占い(Easy)
|
| コンテスト | |
| ユーザー |
aaa
|
| 提出日時 | 2018-10-29 16:07:46 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 14 ms / 2,000 ms |
| コード長 | 1,111 bytes |
| コンパイル時間 | 1,164 ms |
| コンパイル使用メモリ | 100,468 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-11-19 07:41:10 |
| 合計ジャッジ時間 | 1,959 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 22 |
ソースコード
#include <stdio.h>
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
#include <functional>
#include <map>
#include <iomanip>
#include <math.h>
#include <stack>
#include <queue>
#include <bitset>
#include <cstdlib>
#include <tuple>
#include <cctype>
#include <ctype.h>
#include <set>
#include <sstream>
using namespace std;
int main(){
int i, j;
int t;
vector<string>s;
vector<string>list;
cin >> t;
for (i = 0; i < t; i++) {
string str;
cin >> str;
s.push_back(str);
}
for (i = 0; i < t; i++) {
string str = s[i];
if (str.length() == 1) {
list.push_back(str);
continue;
}
while (true) {
string str2 = "";
for (j = 0; j < str.length() - 1; j++) {
int num = ((int)str[j] - 48) + ((int)str[j + 1] - 48);
if (num > 9) {
num = ((int)to_string(num)[0] - 48) + ((int)to_string(num)[1] - 48 );
}
str2 += to_string(num);
}
if (str2.length() == 1) {
list.push_back(str2);
break;
}
str = str2;
}
}
for (i = 0; i < list.size(); i++) {
cout << list[i] << endl;
}
getchar();
getchar();
return 0;
}
aaa