結果

問題 No.1362 [Zelkova 8th Tune] Black Sheep
ユーザー Drice
提出日時 2021-01-22 21:52:13
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 5 ms / 1,000 ms
コード長 380 bytes
コンパイル時間 780 ms
コンパイル使用メモリ 32,000 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-12-27 23:51:42
合計ジャッジ時間 3,213 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 38
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <cstdio>
#include <cstring>
char s[500005];

int main(){
    scanf("%s",s+1);
    int n = strlen(s+1);
    int cnt = 0;
    int find = -1;
    for(int i = 2; i <= n; i++){
        if(s[i]!=s[1]){
            if(find==-1) find = i;
            cnt++;
        }
    }
    if(cnt==n-1) printf("%d %c\n",1,s[1]);
    else printf("%d %c\n",find,s[find]);
    
    return 0;
}
0