結果

問題 No.2156 ぞい文字列
ユーザー tailstails
提出日時 2023-01-26 18:17:03
言語 C90
(gcc 11.4.0)
結果
AC  
実行時間 1 ms / 2,000 ms
コード長 1,782 bytes
コンパイル時間 1,115 ms
コンパイル使用メモリ 25,152 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-09 18:09:50
合計ジャッジ時間 2,500 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 0 ms
4,376 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 0 ms
4,380 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 1 ms
4,376 KB
testcase_06 AC 1 ms
4,376 KB
testcase_07 AC 1 ms
4,376 KB
testcase_08 AC 0 ms
4,376 KB
testcase_09 AC 0 ms
4,384 KB
testcase_10 AC 1 ms
4,380 KB
testcase_11 AC 1 ms
4,376 KB
testcase_12 AC 0 ms
4,376 KB
testcase_13 AC 0 ms
4,376 KB
testcase_14 AC 1 ms
4,380 KB
testcase_15 AC 0 ms
4,376 KB
testcase_16 AC 1 ms
4,376 KB
testcase_17 AC 0 ms
4,384 KB
testcase_18 AC 1 ms
4,380 KB
testcase_19 AC 0 ms
4,376 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c:71:1: warning: return type defaults to ‘int’ [-Wimplicit-int]
 main(){
 ^~~~
main.c: In function ‘main’:
main.c:73:2: warning: implicit declaration of function ‘scanf’ [-Wimplicit-function-declaration]
  scanf("%lu",&n);
  ^~~~~
main.c:73:2: warning: incompatible implicit declaration of built-in function ‘scanf’
main.c:73:2: note: include ‘<stdio.h>’ or provide a declaration of ‘scanf’
main.c:1:1:
+#include <stdio.h>
 #pragma GCC optimize("Ofast")
main.c:73:2:
  scanf("%lu",&n);
  ^~~~~
main.c:84:2: warning: implicit declaration of function ‘printf’ [-Wimplicit-function-declaration]
  printf("%d",(x0+MD-1)%MD);
  ^~~~~~
main.c:84:2: warning: incompatible implicit declaration of built-in function ‘printf’
main.c:84:2: note: include ‘<stdio.h>’ or provide a declaration of ‘printf’

ソースコード

diff #

#pragma GCC optimize("Ofast")
#pragma GCC target("avx2")

#define MD 998244353ul

unsigned a[][2]={
{        0,        1},
{        1,        1},
{        2,        3},
{       13,       21},
{      610,      987},
{  1346269,  2178309},
{  3164985,868874039},
{268416577, 68921677},
{ 73226039,341969642},
{394135662,104186878},
{492539709,245887711},
{700918724,942839953},
{492450285,188323242},
{310045918, 57949216},
{410017171,490320229},
{869685535,688849975},
{752861792,539562357},
{432433814,123638574},
{  3824821,360202863},
{472156872,494782135},
{ 58989191, 70085358},
{801989325,572234585},
{713664768,618697614},
{173605931,121911603},
{849821511,463493561},
{319107674,994942111},
{ 28542621,845731073},
{295681022,778816073},
{117335797,650103746},
{170833367,658742853},
{759024845,961232082},
{821475450,901056802},
{738819114,806212005},
{557220631,498764237},
{746648672,982428304},
{633343556,474738840},
{235955861, 24695414},
{251954951,797269393},
{579769006,267226822},
{460957071,820525996},
{721762697,381746629},
{512280016, 87518178},
{365690101,209461837},
{588711366,548106755},
{366750805,990012936},
{   121997,953351725},
{420032222,713838745},
{770879409,680616443},
{770256962,160433130},
{311807562,892457479},
{335533397,673858075},
{313827235,262902563},
{303375602,550714785},
{522866582,936139088},
{603459412,255407995},
{382955669,635166915},
{322964226,283451749},
{ 33545516,759538387},
{604456116, 62574976},
{313370250,229945172},
};

typedef unsigned long ulong;

main(){
	ulong n,x0=1,x1=0,y0=0,y1=1;
	scanf("%lu",&n);
	for(n+=2;n;){
		ulong z=__builtin_ctzl(n);
		n-=1ul<<z;
		ulong y0=a[z][0];
		ulong y1=a[z][1];
		ulong t0=x0*y0+x1*y1;
		ulong t1=(x0+x1)*(y0+y1)-x0*y0;
		x0=t0%MD;
		x1=t1%MD;
	}
	printf("%d",(x0+MD-1)%MD);
}
0