結果
| 問題 | No.1362 [Zelkova 8th Tune] Black Sheep |
| コンテスト | |
| ユーザー |
mag
|
| 提出日時 | 2021-01-28 23:06:27 |
| 言語 | C++14 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 4 ms / 1,000 ms |
| コード長 | 571 bytes |
| 記録 | |
| コンパイル時間 | 1,097 ms |
| コンパイル使用メモリ | 190,324 KB |
| 実行使用メモリ | 6,272 KB |
| 最終ジャッジ日時 | 2026-03-12 22:38:31 |
| 合計ジャッジ時間 | 2,271 ms |
|
ジャッジサーバーID (参考情報) |
judge2_1 / judge1_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 38 |
コンパイルメッセージ
main.cpp: In function 'int main()':
main.cpp:22:5: warning: 'target' may be used uninitialized [-Wmaybe-uninitialized]
22 | if(target==s[i]){
| ^~
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;
}
}
}
mag