結果
| 問題 |
No.1362 [Zelkova 8th Tune] Black Sheep
|
| コンテスト | |
| ユーザー |
👑 Kazun
|
| 提出日時 | 2020-09-26 03:19:08 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 15 ms / 1,000 ms |
| コード長 | 376 bytes |
| コンパイル時間 | 672 ms |
| コンパイル使用メモリ | 76,756 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-07-23 18:22:00 |
| 合計ジャッジ時間 | 2,123 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 38 |
コンパイルメッセージ
main.cpp: In function 'int main()':
main.cpp:29:23: warning: 'T' may be used uninitialized [-Wmaybe-uninitialized]
29 | cout << S.find(T) + 1 << " " << T << endl;
| ~~~~~~^~~
main.cpp:9:14: note: 'T' was declared here
9 | char T;
| ^
ソースコード
#include<iostream>
#include<map>
#include<string>
using namespace std;
int main() {
string S;
char T;
map<char, int> M;
cin >> S;
for (int i = 0; i < S.size(); i++) {
if (M.count(S[i])) {
M[S[i]] += 1;
}
else {
M[S[i]] = 1;
}
}
for (auto x : M) {
if (x.second == 1) {
T = x.first;
}
}
cout << S.find(T) + 1 << " " << T << endl;
return 0;
}
Kazun