結果
| 問題 |
No.84 悪の算盤
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2018-05-20 12:33:14 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 340 bytes |
| コンパイル時間 | 497 ms |
| コンパイル使用メモリ | 63,232 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-06-28 14:37:48 |
| 合計ジャッジ時間 | 1,052 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 WA * 2 |
| other | AC * 3 WA * 7 |
コンパイルメッセージ
main.cpp: In function 'int main()':
main.cpp:18:19: warning: 'ans' may be used uninitialized [-Wmaybe-uninitialized]
18 | cout << (ans-1) << endl;
| ^
main.cpp:7:14: note: 'ans' was declared here
7 | ll r, c, ans;
| ^~~
ソースコード
#include<iostream>
using namespace std;
typedef long long ll;
int main(){
ll r, c, ans;
cin >> r >> c;
if(r != c){
ll ans = r/2 * c;
if(r%2 == 1) ans += (c+1)/2;
}else{
if(r%2 == 0) ans = r*r/4;
else ans = (r*r-1)/4+1;
}
cout << (ans-1) << endl;
return 0;
}