結果
| 問題 |
No.1010 折って重ねて
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-04-01 18:20:52 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 787 bytes |
| コンパイル時間 | 1,604 ms |
| コンパイル使用メモリ | 167,144 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-06-27 02:26:27 |
| 合計ジャッジ時間 | 3,163 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 42 WA * 1 |
コンパイルメッセージ
main.cpp: In function 'int main()':
main.cpp:34:14: warning: 'count' may be used uninitialized [-Wmaybe-uninitialized]
34 | count++;
| ~~~~~^~
main.cpp:5:18: note: 'count' was declared here
5 | double x, y, h,count;
| ^~~~~
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main(){
double x, y, h,count;
cin >> x >> y >> h;
if (x >= y) {
for (int i = 0; ; i++) {
if (y > h/1000) {
y /= 2;
h *= 2;
count++;
}
else {
break;
}
}
for (int i = 0; ; i++) {
if (x > h/1000) {
x /= 2;
h *= 2;
count++;
}
else {
break;
}
}
}
if (y > x) {
for (int i = 0; ; i++) {
if (x > h/1000) {
x /= 2;
h *= 2;
count++;
}
else {
break;
}
}
for (int i = 0; ; i++) {
if (y > h/1000) {
y /= 2;
h *= 2;
count++;
}
else {
break;
}
}
}
cout << count << endl;
}