B - ABC400 Party Editorial by Binary_64

Solution for Problem A

So far, there is no English solution for this problem, so I wrote one.


It is easy to prove that if two positive integers \(A\) and \(B\) satisfy \(AB = 400\), then it must be that \(A \mid 400\) and \(B \mid 400\) (although the converse does not necessarily hold).

However, if there exists a positive integer \(x\) such that \(x \mid 400\), then there must exist a positive integer \(y\) such that \(xy = 400\). Specifically, we can construct \(y = \frac{400}{x}\). Then we have:

\[ xy = x \times \frac{400}{x} = 400 \]

#pragma GCC optimize(3,"Ofast","inline","unroll-loops")
#include<bits/stdc++.h>
#define int long long
using namespace std;
signed main() {
    cin.tie(0)->sync_with_stdio(false);
    int a,b;cin>>a;
    if(400%a==0)cout<<400/a<<'\n';
    else cout<<"-1\n";
    return 0;
}
n=int(input())
if(400%n==0):print(400//n)
else:print(-1)

posted:
last update: