結果
| 問題 | No.178 美しいWhitespace (1) |
| コンテスト | |
| ユーザー |
Bantako
|
| 提出日時 | 2017-07-02 19:26:50 |
| 言語 | C++11 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 644 bytes |
| 記録 | |
| コンパイル時間 | 124 ms |
| コンパイル使用メモリ | 38,400 KB |
| 実行使用メモリ | 6,400 KB |
| 最終ジャッジ日時 | 2026-04-20 21:52:43 |
| 合計ジャッジ時間 | 1,319 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge2_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 7 WA * 14 |
コンパイルメッセージ
main.cpp:2:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
2 | main(){
| ^~~~
ソースコード
#include<stdio.h>
main(){
int N;
scanf("%d",&N);
int A,B;
scanf("%d %d",&A,&B);
int isodd = A%2;//奇数かどうかのフラグ
int max = A + 4*B;
int count = 0;
for(int i=1;i < N;i++){
scanf("%d %d",&A,&B);
//もし偶奇が一致しなかったら
if(isodd != A%2){
printf("-1\n");
return 0;
}
if(max < A + 4*B){//最大値更新
count += (A + 4*B - max)/2 * i;//現最大値と前最大値の差*行数
max = A + 4*B;
}else{
count += (max - (A+4*B)) / 2;
}
}
printf("%d\n",count);
}
Bantako