結果
| 問題 | No.1362 [Zelkova 8th Tune] Black Sheep |
| コンテスト | |
| ユーザー |
monnu
|
| 提出日時 | 2021-01-23 01:16:58 |
| 言語 | C++14 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 444 bytes |
| 記録 | |
| コンパイル時間 | 2,780 ms |
| コンパイル使用メモリ | 245,700 KB |
| 実行使用メモリ | 6,400 KB |
| 最終ジャッジ日時 | 2026-06-03 03:36:04 |
| 合計ジャッジ時間 | 5,420 ms |
|
ジャッジサーバーID (参考情報) |
judge1_1 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | WA * 38 |
コンパイルメッセージ
main.cpp: In function 'int main()':
main.cpp:21:8: warning: ignoring return value of 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::reference std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::operator[](size_type) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; reference = char&; size_type = long unsigned int]', declared with attribute 'nodiscard' [-Wunused-result]
21 | S[0];
| ^
In file included from /home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/string:56,
from /home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/bitset:54,
from /home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/x86_64-pc-linux-gnu/bits/stdc++.h:54,
from main.cpp:1:
/home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/bits/basic_string.h:1365:7: note: declared here
1365 | operator[](size_type __pos)
| ^~~~~~~~
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