結果

問題 No.523 LED
コンテスト
ユーザー RIGIH
提出日時 2017-06-23 19:08:32
言語 C++11
(gcc 15.2.0 + boost 1.89.0)
コンパイル:
g++-15 -O2 -lm -std=gnu++11 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
WA  
実行時間 -
コード長 318 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 567 ms
コンパイル使用メモリ 77,012 KB
実行使用メモリ 6,400 KB
最終ジャッジ日時 2026-04-20 00:00:26
合計ジャッジ時間 1,825 ms
ジャッジサーバーID
(参考情報)
judge2_1 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 15 WA * 10
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function 'int main()':
main.cpp:23:23: warning: 'ans' may be used uninitialized [-Wmaybe-uninitialized]
   23 |                 printf("%d\n",ans);
      |                 ~~~~~~^~~~~~~~~~~~
main.cpp:13:22: note: 'ans' was declared here
   13 |                 long ans,a=1;
      |                      ^~~

ソースコード

diff #
raw source code

#include<stdio.h>
#include <iostream>
#include <cstring>
#include <math.h>
using namespace std;


int main(){

		int n;
		cin>>n;
		int i=1;
		long ans,a=1;
		if(n==1){
			printf("1\n");
			return 0;
		}
		for(i=2;i<=n;i++){
			ans=(a*i*(2*i-1))%1000000007;
			a=ans;
		}

		printf("%d\n",ans);

	
	

	

	
	return 0;
}
0