結果
| 問題 |
No.276 連続する整数の和(1)
|
| コンテスト | |
| ユーザー |
kahuu
|
| 提出日時 | 2016-04-03 00:38:15 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 301 bytes |
| コンパイル時間 | 1,759 ms |
| コンパイル使用メモリ | 158,752 KB |
| 実行使用メモリ | 13,632 KB |
| 最終ジャッジ日時 | 2024-10-02 12:31:35 |
| 合計ジャッジ時間 | 6,097 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 5 WA * 1 TLE * 2 -- * 2 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:8:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
8 | LL n; scanf("%lld", &n);
| ~~~~~^~~~~~~~~~~~
ソースコード
#include <bits/stdc++.h>
#define LL long long
LL sum(LL x);
int main(void) {
LL n; scanf("%lld", &n);
for (LL i = n; i >= 1; i--) {
if ((sum(n) * (n / i) + sum(n % i)) % i == 0) {
printf("%lld\n", i);
break;
}
}
return 0;
}
LL sum(LL x) {
return (1 + x) * x / 2;
}
kahuu