結果

問題 No.613 Solitude by the window
ユーザー tailstails
提出日時 2017-12-12 23:54:24
言語 C
(gcc 12.3.0)
結果
TLE  
実行時間 -
コード長 398 bytes
コンパイル時間 198 ms
コンパイル使用メモリ 28,800 KB
実行使用メモリ 8,736 KB
最終ジャッジ日時 2024-05-08 05:37:55
合計ジャッジ時間 3,666 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
6,784 KB
testcase_01 AC 1 ms
5,376 KB
testcase_02 TLE -
testcase_03 -- -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function 'f':
main.c:7:5: warning: type of 'x' defaults to 'int' [-Wimplicit-int]
    7 | int f(x){
      |     ^
main.c: At top level:
main.c:11:1: warning: return type defaults to 'int' [-Wimplicit-int]
   11 | main(){
      | ^~~~
main.c: In function 'main':
main.c:12:9: warning: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
   12 |         scanf("%lld%d",&n,&m);
      |         ^~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
  +++ |+#include <stdio.h>
    1 | typedef long long ll;
main.c:12:9: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
   12 |         scanf("%lld%d",&n,&m);
      |         ^~~~~
main.c:12:9: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:42:9: warning: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
   42 |         printf("%d",a);
      |         ^~~~~~
main.c:42:9: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:42:9: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:42:9: note: include '<stdio.h>' or provide a declaration of 'printf'

ソースコード

diff #

typedef long long ll;
ll n;
int m;
int a,b;
int l;

int f(x){
	return (ll)x*(x+4)%m;
}

main(){
	scanf("%lld%d",&n,&m);
	a=2;
	b=2;
	l=0;
#if 0
	for(;n>0;){
		a=f(a);
		b=f(f(b));
		--n;
		if(a==b)break;
	}
	for(;n>0;){
		a=f(a);
		++l;
		--n;
		if(a==b)break;
	}
#else
	for(;n>0;){
		a=f(a);
		++l;
		--n;
		if(a==2)break;
	}
#endif
	if(n)n%=l;
	for(;n>0;){
		a=f(a);
		--n;
	}
	printf("%d",a);
}
0