結果
問題 | No.1362 [Zelkova 8th Tune] Black Sheep |
ユーザー |
|
提出日時 | 2024-02-22 15:21:58 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 552 bytes |
コンパイル時間 | 2,257 ms |
コンパイル使用メモリ | 159,076 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-09-29 04:27:56 |
合計ジャッジ時間 | 4,002 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | WA * 38 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:22:9: warning: ‘ans’ may be used uninitialized in this function [-Wmaybe-uninitialized] 22 | if (c == ans) { | ^~
ソースコード
#include <bits/stdc++.h> using namespace std; int ar[1000]; int main() { string s; cin >> s; for (auto c : s) { ar[c]++; } char ans; for (int i = 0; i < 1000; i++) { if (ar[i] == 1) { ans = i; //cout << char(i) << endl; } } int j = 1; for (auto c : s) { if (c == ans) { cout << j; } j++; } for (int i = 0; i < 1000; i++) { if (ar[i] == 1) { cout << char(i) << endl; } } return 0; }