結果
問題 | No.3066 Collecting Coins Speedrun 1 |
ユーザー |
![]() |
提出日時 | 2025-03-21 21:29:36 |
言語 | C (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 14 ms / 2,000 ms |
コード長 | 326 bytes |
コンパイル時間 | 411 ms |
コンパイル使用メモリ | 24,576 KB |
実行使用メモリ | 5,888 KB |
最終ジャッジ日時 | 2025-03-21 21:29:38 |
合計ジャッジ時間 | 1,556 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 32 |
コンパイルメッセージ
main.c: In function ‘main’: main.c:6:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 6 | scanf("%lld", &n); | ^~~~~~~~~~~~~~~~~ main.c:9:17: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 9 | scanf("%lld", &c[i]); | ^~~~~~~~~~~~~~~~~~~~
ソースコード
#include<stdio.h> long long int c[100005]; int main() { long long int n; scanf("%lld", &n); long long int i; for (i = 0; i < n; i++) scanf("%lld", &c[i]); if (c[n - 1] < 0) printf("%lld\n", -2 * c[0]); else if (c[0] > 0) printf("%lld\n", 2 * c[n - 1]); else printf("%lld\n", 2 * (c[n - 1] - c[0])); return 0; }