結果
| 問題 | 
                            No.1362 [Zelkova 8th Tune] Black Sheep
                             | 
                    
| コンテスト | |
| ユーザー | 
                             monnu
                         | 
                    
| 提出日時 | 2021-01-23 01:16:58 | 
| 言語 | C++14  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 444 bytes | 
| コンパイル時間 | 3,748 ms | 
| コンパイル使用メモリ | 229,064 KB | 
| 実行使用メモリ | 6,824 KB | 
| 最終ジャッジ日時 | 2024-12-29 08:01:28 | 
| 合計ジャッジ時間 | 6,196 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge5 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | WA * 38 | 
コンパイルメッセージ
main.cpp: In function 'int main()':
main.cpp:25:13: warning: 'c' may be used uninitialized [-Wmaybe-uninitialized]
   25 |   while(S[i]==c){
main.cpp:15:8: note: 'c' was declared here
   15 |   char c;
      |        ^
            
            ソースコード
#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;
  cout<<S<<endl;
  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;
}
            
            
            
        
            
monnu