結果

問題 No.344 ある無理数の累乗
ユーザー cielciel
提出日時 2016-02-13 12:26:22
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 697 bytes
コンパイル時間 393 ms
コンパイル使用メモリ 53,064 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-22 04:56:58
合計ジャッジ時間 1,384 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 1 ms
4,348 KB
testcase_02 WA -
testcase_03 AC 2 ms
4,348 KB
testcase_04 WA -
testcase_05 AC 2 ms
4,348 KB
testcase_06 WA -
testcase_07 AC 1 ms
4,348 KB
testcase_08 WA -
testcase_09 AC 2 ms
4,348 KB
testcase_10 WA -
testcase_11 AC 1 ms
4,348 KB
testcase_12 WA -
testcase_13 AC 2 ms
4,348 KB
testcase_14 WA -
testcase_15 AC 2 ms
4,348 KB
testcase_16 WA -
testcase_17 AC 1 ms
4,348 KB
testcase_18 AC 1 ms
4,348 KB
testcase_19 WA -
testcase_20 AC 2 ms
4,348 KB
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 1 ms
4,348 KB
testcase_24 WA -
testcase_25 AC 2 ms
4,348 KB
testcase_26 WA -
testcase_27 AC 1 ms
4,348 KB
testcase_28 AC 1 ms
4,348 KB
testcase_29 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:18:1: warning: ISO C++ forbids declaration of ‘main’ with no type [-Wreturn-type]
   18 | main(){
      | ^~~~

ソースコード

diff #

//icpc2012rC
#include <valarray>
#include <cstdio>
using namespace std;
typedef valarray<long long>V;
int n=2,m=100000000; //lol
V z;
V &Me(const V &_x,const V &_y){
	int i=0,j;
	for(;i<n;i++)for(j=0;j<n;j++)z[i*n+j]=(_x[slice(i*n,n,1)]*_y[slice(j,n,n)]).sum()%m;
	return z;
}
V &Mx(const V &_x){
	int i=0,j;
	for(;i<n;i++)for(j=0;j<n;j++)z[i*n+j]=(_x[slice(i*n,n,1)]*_x[slice(j,n,n)]).sum()%m;
	return z;
}
main(){
	int t=1,T,r;
	for(;~scanf("%d",&r);){
		V x(n*n);
		V e(n*n);
		z.resize(n*n);

		x[0]=1,x[1]=3,x[2]=1,x[3]=1;
		e[0]=1,e[3]=1; //unit

		for(;r;r>>=1){
			if(r&1)e=Me(e,x);
			x=Mx(x);
		}
		printf("%d\n",(int)(2*e[0])%1000);
		//printf("%d %d %d %d\n",e[0],e[1],e[2],e[3]);
	}
}
0