提出 #30229214
ソースコード 拡げる
#include<cstdio>
inline long long GCD(const long long a,const long long b)
{
return b?GCD(b,a%b):a;
}
int main()
{
long long a,b;
scanf("%lld%lld",&a,&b);
for(long long i=0;;++i)
{
bool flag=0;
for(long long j=0;j<=i;++j)
{
if(GCD(a+j,b-(i-j))==1)
{
flag=1;
break;
}
}
if(flag)
{
printf("%lld",b-a-i);
return 0;
}
}
return 0;
}
提出情報
| 提出日時 | |
|---|---|
| 問題 | A - Coprime Pair |
| ユーザ | LXl491214 |
| 言語 | C++ (GCC 9.2.1) |
| 得点 | 300 |
| コード長 | 398 Byte |
| 結果 | AC |
| 実行時間 | 4 ms |
| メモリ | 1736 KiB |
コンパイルエラー
./Main.cpp: In function ‘int main()’:
./Main.cpp:9:7: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
9 | scanf("%lld%lld",&a,&b);
| ~~~~~^~~~~~~~~~~~~~~~~~
ジャッジ結果
| セット名 | Sample | All | ||||
|---|---|---|---|---|---|---|
| 得点 / 配点 | 0 / 0 | 300 / 300 | ||||
| 結果 |
|
|
| セット名 | テストケース |
|---|---|
| Sample | 00-sample-001.txt, 00-sample-002.txt, 00-sample-003.txt |
| All | 00-sample-001.txt, 00-sample-002.txt, 00-sample-003.txt, 01-001.txt, 01-002.txt, 01-003.txt, 01-004.txt, 01-005.txt, 01-006.txt, 01-007.txt, 01-008.txt, 01-009.txt, 01-010.txt, 01-011.txt, 01-012.txt, 01-013.txt, 01-014.txt, 01-015.txt, 01-016.txt, 01-017.txt, 01-018.txt, 01-019.txt, 01-020.txt, 01-021.txt |
| ケース名 | 結果 | 実行時間 | メモリ |
|---|---|---|---|
| 00-sample-001.txt | AC | 2 ms | 1676 KiB |
| 00-sample-002.txt | AC | 2 ms | 1724 KiB |
| 00-sample-003.txt | AC | 1 ms | 1728 KiB |
| 01-001.txt | AC | 1 ms | 1648 KiB |
| 01-002.txt | AC | 1 ms | 1728 KiB |
| 01-003.txt | AC | 2 ms | 1732 KiB |
| 01-004.txt | AC | 1 ms | 1676 KiB |
| 01-005.txt | AC | 1 ms | 1724 KiB |
| 01-006.txt | AC | 1 ms | 1672 KiB |
| 01-007.txt | AC | 1 ms | 1684 KiB |
| 01-008.txt | AC | 1 ms | 1676 KiB |
| 01-009.txt | AC | 1 ms | 1712 KiB |
| 01-010.txt | AC | 1 ms | 1680 KiB |
| 01-011.txt | AC | 1 ms | 1632 KiB |
| 01-012.txt | AC | 1 ms | 1644 KiB |
| 01-013.txt | AC | 1 ms | 1652 KiB |
| 01-014.txt | AC | 1 ms | 1680 KiB |
| 01-015.txt | AC | 1 ms | 1736 KiB |
| 01-016.txt | AC | 1 ms | 1672 KiB |
| 01-017.txt | AC | 1 ms | 1676 KiB |
| 01-018.txt | AC | 1 ms | 1636 KiB |
| 01-019.txt | AC | 2 ms | 1676 KiB |
| 01-020.txt | AC | 4 ms | 1708 KiB |
| 01-021.txt | AC | 1 ms | 1640 KiB |