結果
問題 | No.1543 [Cherry 2nd Tune A] これがプログラミングなのね |
ユーザー |
|
提出日時 | 2021-06-11 22:22:31 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 29 ms / 2,000 ms |
コード長 | 520 bytes |
コンパイル時間 | 698 ms |
コンパイル使用メモリ | 65,996 KB |
最終ジャッジ日時 | 2025-01-22 06:09:15 |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 35 |
コンパイルメッセージ
main.cpp: In function ‘void solve()’: main.cpp:26:37: warning: ‘ans’ may be used uninitialized [-Wmaybe-uninitialized] 26 | cout << (ans ? "YES" : "NO") << "\n"; | ^~~~ main.cpp:10:10: note: ‘ans’ was declared here 10 | bool ans; | ^~~
ソースコード
#include <iostream>using namespace std;void solve() {int s, t;char c;cin >> s >> t >> c;bool ans;switch (c) {case '<': {ans = (s < t);break;}case '>': {ans = (s > t);break;}case '=': {ans = (s == t);break;}}cout << (ans ? "YES" : "NO") << "\n";}int main() {cin.tie(nullptr);ios::sync_with_stdio(false);solve();return 0;}