結果
| 問題 |
No.536 人工知能
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2018-05-01 15:31:40 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 1,000 ms |
| コード長 | 592 bytes |
| コンパイル時間 | 516 ms |
| コンパイル使用メモリ | 61,584 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-06-28 00:11:20 |
| 合計ジャッジ時間 | 956 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 11 |
ソースコード
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main() {
std::cin.tie(0);
std::ios::sync_with_stdio(false);
string S;
cin >> S;
if(S.size() < 2){
cout << S << "-AI" << endl;
return 0;
}
string target = "ia";
int c = 0;
for(auto itr = S.rbegin(); itr != S.rend(); itr++){
if(c >= target.size()) break;
if(*itr != target[c]){
break;
}
c++;
}
if(c >= 2){
S.at(S.size() - 1) = 'I';
S.at(S.size() - 2) = 'A';
cout << S << endl;
}else{
cout << S << "-AI" << endl;
}
return 0;
}