結果
問題 | No.1362 [Zelkova 8th Tune] Black Sheep |
ユーザー |
![]() |
提出日時 | 2021-01-28 23:06:27 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 6 ms / 1,000 ms |
コード長 | 571 bytes |
コンパイル時間 | 1,678 ms |
コンパイル使用メモリ | 173,352 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-06-26 06:49:20 |
合計ジャッジ時間 | 3,113 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 38 |
コンパイルメッセージ
main.cpp: In function 'int main()': main.cpp:23:23: warning: 'target' may be used uninitialized [-Wmaybe-uninitialized] 23 | cout<<i+1<<" "<<target<<endl; | ^~~~~~ main.cpp:13:8: note: 'target' was declared here 13 | char target; | ^~~~~~
ソースコード
#include<bits/stdc++.h> using namespace std; using ll=long long; #define rep2(i, a, n) for(int i = (a); i < (n); i++) #define rep(i, n) rep2(i,0,n) int main(){ cin.tie(nullptr);ios_base::sync_with_stdio(false); string s;cin>>s; map<char,int> map; rep(i,s.size())map[s[i]]++; char target; for(auto itr=map.begin();itr!=map.end();++itr){ //cout<<"key="<<itr->first<<",val="<<itr->second<<"\n"; if(itr->second==1){ target=itr->first; break; } } rep(i,s.size()){ if(target==s[i]){ cout<<i+1<<" "<<target<<endl; } } }