結果

問題 No.1113 二つの整数 / Two Integers
ユーザー pengin_2000pengin_2000
提出日時 2021-10-26 00:41:28
言語 C
(gcc 12.3.0)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 608 bytes
コンパイル時間 252 ms
コンパイル使用メモリ 29,952 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-14 21:23:28
合計ジャッジ時間 1,203 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
6,812 KB
testcase_01 AC 2 ms
6,812 KB
testcase_02 AC 1 ms
6,816 KB
testcase_03 AC 1 ms
6,812 KB
testcase_04 AC 1 ms
6,944 KB
testcase_05 AC 1 ms
6,944 KB
testcase_06 AC 1 ms
6,940 KB
testcase_07 AC 1 ms
6,940 KB
testcase_08 AC 1 ms
6,940 KB
testcase_09 AC 1 ms
6,940 KB
testcase_10 AC 1 ms
6,944 KB
testcase_11 AC 1 ms
6,944 KB
testcase_12 AC 1 ms
6,940 KB
testcase_13 AC 1 ms
6,940 KB
testcase_14 AC 1 ms
6,940 KB
testcase_15 AC 1 ms
6,940 KB
testcase_16 AC 1 ms
6,940 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c:13:15: warning: conflicting types for built-in function 'sqrt'; expected 'double(double)' [-Wbuiltin-declaration-mismatch]
   13 | long long int sqrt(long long int n)
      |               ^~~~
main.c:2:1: note: 'sqrt' is declared in header '<math.h>'
    1 | #include<stdio.h>
  +++ |+#include <math.h>
    2 | long long int gcd(long long int a, long long int b)

ソースコード

diff #

#include<stdio.h>
long long int gcd(long long int a, long long int b)
{
	long long int r = a % b;
	while (r > 0)
	{
		a = b;
		b = r;
		r = a % b;
	}
	return b;
}
long long int sqrt(long long int n)
{
	long long int min, mid, max;
	min = 0;
	max = 1;
	while (max * max <= n)
		max *= 2;
	while (max - min > 1)
	{
		mid = (max + min) / 2;
		if (mid * mid <= n)
			min = mid;
		else
			max = mid;
	}
	return min;
}
int main()
{
	long long int a, b;
	scanf("%lld %lld", &a, &b);
	long long int g = gcd(a, b);
	long long int r = sqrt(g);
	if (r * r == g)
		printf("Odd\n");
	else
		printf("Even\n");
	return 0;
}
0