QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#423429#5553. Alternative ArchitectureoklatiWA 10ms3668kbC++17950b2024-05-28 01:47:222024-05-28 01:47:23

Judging History

你现在查看的是最新测评结果

  • [2024-05-28 01:47:23]
  • 评测
  • 测评结果:WA
  • 用时:10ms
  • 内存:3668kb
  • [2024-05-28 01:47:22]
  • 提交

answer

#include <bits/stdc++.h>
#define F first
#define S second
#define pb push_back
#define all(x) x.begin(),x.end()
#define FASTIO ios_base::sync_with_stdio(false), cin.tie(0)
#define txin ifstream cin("input.txt")
#define txout ofstream cout("output.txt")
using namespace std;
typedef long long ll ;
typedef long double ld;
typedef pair<int,int> pii ;
//mt19937 r(chrono::steady_clock::now().time_since_epoch().count()) ;
const int MAXN = 1e6 + 10;
const int MOD = 1e9 + 7;
 
 
int32_t main(){
	FASTIO;
	
	ll a, b;
	cin >> a >> b;
	a--;b--;
	if(a > b)
		swap(a,b);
	
	if(a%b!=0 && b%a!=0){
		if(a == b)
			cout << 1<< endl;
		else
			cout << 2<< endl;
	}
	else{
		//~ a <= b
		ll f=0;
		for(ll i=1; i< a; i++){
			long double k = sqrtl(a*a - i*i);
			ll kk= floor(k);
			if(kk*kk == a*a - i*i){
				f++;
			}
		}
		if(a==b)
			cout << f + 1 << endl;
		else
			cout << 2*f + 2 << endl;
	}
    return 0;
}

詳細信息

Test #1:

score: 100
Accepted
time: 0ms
memory: 3636kb

input:

6 11

output:

6

result:

ok single line: '6'

Test #2:

score: 0
Accepted
time: 0ms
memory: 3508kb

input:

26 26

output:

5

result:

ok single line: '5'

Test #3:

score: 0
Accepted
time: 0ms
memory: 3648kb

input:

123 456

output:

2

result:

ok single line: '2'

Test #4:

score: 0
Accepted
time: 0ms
memory: 3512kb

input:

3 3

output:

1

result:

ok single line: '1'

Test #5:

score: 0
Accepted
time: 0ms
memory: 3668kb

input:

2 2

output:

1

result:

ok single line: '1'

Test #6:

score: 0
Accepted
time: 0ms
memory: 3512kb

input:

2 1000000

output:

2

result:

ok single line: '2'

Test #7:

score: 0
Accepted
time: 0ms
memory: 3564kb

input:

1000000 2

output:

2

result:

ok single line: '2'

Test #8:

score: 0
Accepted
time: 10ms
memory: 3520kb

input:

1000000 1000000

output:

9

result:

ok single line: '9'

Test #9:

score: -100
Wrong Answer
time: 0ms
memory: 3556kb

input:

320451 480676

output:

2

result:

wrong answer 1st lines differ - expected: '270', found: '2'