結果
| 問題 |
No.77 レンガのピラミッド
|
| コンテスト | |
| ユーザー |
goodbaton
|
| 提出日時 | 2014-11-25 23:26:25 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 519 bytes |
| コンパイル時間 | 921 ms |
| コンパイル使用メモリ | 74,572 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2025-01-03 02:37:26 |
| 合計ジャッジ時間 | 1,824 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 WA * 1 |
| other | AC * 4 WA * 16 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:17:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
17 | scanf("%d",&n);
| ~~~~~^~~~~~~~~
main.cpp:20:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
20 | scanf("%d",&num[i]);
| ~~~~~^~~~~~~~~~~~~~
ソースコード
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <map>
using namespace std;
int main(){
int num[101],n,ans=0;
scanf("%d",&n);
for(int i=1;i<=n;i++){
scanf("%d",&num[i]);
if(i<=2/n+(n%2))
ans+=max(num[i]-i,0);
else
ans+=max(num[i]-(n-i+1),0);
}
printf("%d\n",ans);
return 0;
}
goodbaton