QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#606746#5553. Alternative Architecturewhale_island#WA 49ms3704kbC++202.7kb2024-10-03 11:56:292024-10-03 11:56:30

Judging History

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

  • [2024-10-03 11:56:30]
  • 评测
  • 测评结果:WA
  • 用时:49ms
  • 内存:3704kb
  • [2024-10-03 11:56:29]
  • 提交

answer

//   __________________
//  | ________________ |
//  ||          ____  ||
//  ||   /\    |      ||
//  ||  /__\   |      ||
//  || /    \  |____  ||
//  ||________________||
//  |__________________|
//  \###################\
//   \###################\
//    \        ____       \
//     \_______\___\_______\
// An AC a day keeps the doctor away.
//#pragma GCC optimize("O3,unroll-loops")
//#pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")
#include <bits/stdc++.h>
#define hutao_my_wife ios_base::sync_with_stdio(0);
#define forcalors_so_cute cin.tie(0);
/*

struct A {
	public: [[nodiscard]] virtual const unsigned long long reference operator bitor (const unsigned long long reference a) const noexcept;

};

struct B: public A{

	public: [[nodiscard]] virtual const unsigned long long reference operator bitor (const unsigned long long reference a) const noexcept override final {

	
	}

};

inline char readchar() noexcept {
    static char buffer[BUFSIZ], * now = buffer + BUFSIZ, * end = buffer + BUFSIZ;
    if (now == end)
    {
        if (end < buffer + BUFSIZ)
            return EOF;
        end = (buffer + fread(buffer, 1, BUFSIZ, stdin));
        now = buffer;
    }
    return *now++;
}
inline int nextint() noexcept {
    int x = 0, c = readchar(), neg = 0;
    while(('0' > c || c > '9') && c!='-' && c!=EOF) c = readchar();
    if(c == '-') neg = true, c = readchar();
    while('0' <= c && c <= '9') x = (x<<3) + (x<<1) + (c^'0'), c = readchar();
    if(neg) x = -x;
    return x; // returns 0 if EOF
}

//fast io cin>>a 改成 a = nextint();
*/
#define ll long long
#define int long long
#define pii pair<int,int>
#define ff first
#define ss second
#define pb push_back
#define eb emplace_back
#define ALL(v) v.begin(), v.end()
#define bug(A) cout<<A<<" hi\n";
using namespace std;

const ll M = 200005;
ll n,m;
ll deal(ll x){
    ll ans = 0;
    for(ll i = 1; i < n; i++){
        ll l = 0, r = n, mid;
        while(r - l > 1){
            mid = (r + l)/2;
            if(x*x - i*i > mid*mid)l = mid;
            else r = mid;
        } 
        if(r*r + i*i == x*x){
            ans++;
           // cout<<r<<' '<<i<<'\n';
        }
        //cout<<r<<' '<<i*i<<' '<<mid*mid<<'\n';
    }
    return ans;
}
void solve(){
    cin>>n>>m;
    n--,m--;
    if(n>m)swap(n,m);

    ll t1 = deal(n);
    //cout<<t1<<'\n';
    if(m%n==0){
        if(n==m)cout<<t1 + 1<<'\n';
        else cout<<t1*2 + 2<<'\n';
    }else{
        if(n==m)cout<<1<<'\n';
        else cout<<2<<'\n';
    }
}

signed main(){
//
    hutao_my_wife    forcalors_so_cute

    int t = 1;
    //cin>>t;
    while(t--){
        solve();
    }
    return 0;
}

详细

Test #1:

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

input:

6 11

output:

6

result:

ok single line: '6'

Test #2:

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

input:

26 26

output:

5

result:

ok single line: '5'

Test #3:

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

input:

123 456

output:

2

result:

ok single line: '2'

Test #4:

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

input:

3 3

output:

1

result:

ok single line: '1'

Test #5:

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

input:

2 2

output:

1

result:

ok single line: '1'

Test #6:

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

input:

2 1000000

output:

2

result:

ok single line: '2'

Test #7:

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

input:

1000000 2

output:

2

result:

ok single line: '2'

Test #8:

score: 0
Accepted
time: 49ms
memory: 3556kb

input:

1000000 1000000

output:

9

result:

ok single line: '9'

Test #9:

score: -100
Wrong Answer
time: 11ms
memory: 3628kb

input:

320451 480676

output:

2

result:

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