結果

問題 No.276 連続する整数の和(1)
ユーザー togaerror
提出日時 2015-09-09 14:42:33
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 298 bytes
コンパイル時間 448 ms
コンパイル使用メモリ 54,132 KB
実行使用メモリ 10,624 KB
最終ジャッジ日時 2024-07-19 05:03:56
合計ジャッジ時間 3,877 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 3 WA * 2 TLE * 1 -- * 4
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:23:17: warning: ‘ans’ may be used uninitialized in this function [-Wmaybe-uninitialized]
   23 |         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