結果
問題 | No.1362 [Zelkova 8th Tune] Black Sheep |
ユーザー | shu8Cream |
提出日時 | 2021-01-22 22:34:26 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 11 ms / 1,000 ms |
コード長 | 660 bytes |
コンパイル時間 | 2,917 ms |
コンパイル使用メモリ | 197,116 KB |
最終ジャッジ日時 | 2025-01-18 04:50:05 |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 38 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:27:21: warning: ‘tmp’ may be used uninitialized [-Wmaybe-uninitialized] 27 | rep(i,s.size()) if(s[i]!=tmp){ | ^~ main.cpp:21:10: note: ‘tmp’ was declared here 21 | char tmp, c; | ^~~
ソースコード
/** * author: shu8Cream * created: 22.01.2021 22:20:38 **/ #include <bits/stdc++.h> using namespace std; #define rep(i,n) for (int i=0; i<(n); i++) #define all(x) (x).begin(), (x).end() using ll = long long; using P = pair<int,int>; using vi = vector<int>; using vvi = vector<vi>; int main() { cin.tie(nullptr); ios::sync_with_stdio(false); string s; cin >> s; set<char> se; char tmp, c; rep(i,s.size()){ if(se.count(s[i])) tmp = s[i]; se.insert(s[i]); } int ans = 0; rep(i,s.size()) if(s[i]!=tmp){ ans=i+1; tmp=s[i]; break; } cout << ans << " " << tmp << endl; }