結果

問題 No.276 連続する整数の和(1)
ユーザー kahuukahuu
提出日時 2016-04-03 00:38:15
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 301 bytes
コンパイル時間 1,890 ms
コンパイル使用メモリ 157,492 KB
実行使用メモリ 14,016 KB
最終ジャッジ日時 2024-04-10 10:40:47
合計ジャッジ時間 6,173 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
9,884 KB
testcase_01 AC 2 ms
6,944 KB
testcase_02 AC 2 ms
6,940 KB
testcase_03 WA -
testcase_04 AC 2 ms
6,940 KB
testcase_05 TLE -
testcase_06 AC 2 ms
6,940 KB
testcase_07 TLE -
testcase_08 -- -
testcase_09 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
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);
      |         ~~~~~^~~~~~~~~~~~

ソースコード

diff #

#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;
}
0