結果
| 問題 |
No.1362 [Zelkova 8th Tune] Black Sheep
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-02-22 18:52:11 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 3 ms / 1,000 ms |
| コード長 | 466 bytes |
| コンパイル時間 | 1,070 ms |
| コンパイル使用メモリ | 160,368 KB |
| 実行使用メモリ | 6,824 KB |
| 最終ジャッジ日時 | 2024-09-29 04:28:48 |
| 合計ジャッジ時間 | 2,022 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 38 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
string s;
cin >> s;
int ans = -1;
if (s[0] == s.back()) {
for (int i = 1; i < s.size(); i++) {
if (s[i] != s[0])
ans = i + 1;
}
} else {
if (s[0] == s[1])
ans = s.size();
else
ans = 1;
}
cout << ans << " " << s[ans-1] << endl;
return 0;
}