結果

問題 No.276 連続する整数の和(1)
ユーザー togaerrortogaerror
提出日時 2015-09-09 14:42:33
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 298 bytes
コンパイル時間 374 ms
コンパイル使用メモリ 51,716 KB
実行使用メモリ 8,760 KB
最終ジャッジ日時 2023-09-26 10:14:52
合計ジャッジ時間 3,948 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
7,572 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 TLE -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:23:10: warning: ‘ans’ may be used uninitialized in this function [-Wmaybe-uninitialized]
  cout << ans << endl;
          ^~~

ソースコード

diff #

#include <cstdio>
#include <iostream>

using namespace std;

int main() {

	int n;
	int count = 0;
	int ans;

	cin >> n;

	for(int i = 0; i < n; i++) {
		count += i;
	}
	for(int i = 1; i < n + 1; i++) {
		if((n % i == 0)&&(count % i == 0)) {
			ans = i;
		}
	}

	cout << ans << endl;

	return 0;

}
0