結果

問題 No.1362 [Zelkova 8th Tune] Black Sheep
ユーザー monnumonnu
提出日時 2021-01-23 01:18:31
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 431 bytes
コンパイル時間 2,058 ms
コンパイル使用メモリ 165,652 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-12-29 08:02:21
合計ジャッジ時間 3,230 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 36 WA * 2
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function 'int main()':
main.cpp:24:13: warning: 'c' may be used uninitialized [-Wmaybe-uninitialized]
   24 |   while(S[i]==c){
main.cpp:14:8: note: 'c' was declared here
   14 |   char c;
      |        ^

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
//#include <atcoder/all>
//using namespace atcoder;
using ll=long long;
using Graph=vector<vector<int>>;
#define MOD 998244353
#define INF 1000000000000000000
#define MAX 2000

int main(){
  string S;
  cin>>S;
  char c;
  if(S[0]==S[1]){
    c=S[0];
  }else if(S[1]==S[2]){
    c=S[1];
  }else{
    S[0];
  }

  int i=0;
  while(S[i]==c){
    i++;
  }
  cout<<i+1<<" "<<S[i]<<endl;
}
0