Bedao Regular Contest 20 - Đếm cặp
View as PDF
Submit solution
Points:
0.10 (partial)
Time limit:
1.0s
Memory limit:
256M
Input:
stdin
Output:
stdout
Author:
Problem type
Allowed languages
C, C++, Go, Java, Kotlin, Pascal, PyPy, Python, Rust, Scratch
Với mỗi số nguyên ~n~ cho trước, bạn hãy đếm số cặp số ~(a, b)~ (~a, b~ chẵn; ~a, b > 0~) sao cho ~a \cdot a \cdot b \cdot b = n~.
Lưu ý: Cặp ~(a, b)~ có kể thứ tự. Ví dụ, ~(1, 2)~ và ~(2, 1)~ là hai cặp số khác nhau.
Input
Dòng đầu tiên gồm số nguyên dương ~t~ ~(1 \le t \le 20)~ — số bộ test.
~t~ dòng tiếp theo, mỗi dòng gồm một số nguyên dương ~n~ ~(0 < n \le 10^{18})~.
Output
- In ra ~t~ dòng, mỗi dòng gồm một số nguyên là số cặp thoả mãn.
Scoring
| Subtask | Điểm | Giới hạn |
|---|---|---|
| ~1~ | ~10\%~ | ~n \le 10^{6}~ |
| ~2~ | ~30\%~ | ~n \le 10^{12}~ |
| ~3~ | ~60\%~ | ~n \le 10^{18}~ |
Sample Input 1
2
144
72
Sample Output 1
2
0
Notes
Trong testcase thứ 1, các cặp số thoả mãn là: ~(2, 6)~, ~(6, 2)~.
Trong testcase thứ 2, không tồn tại cặp số thoả mãn.

Comments
include<bits/stdc++.h>
define ll long long
define maymaythanghuyen iosbase::syncwith_stdio(false);cin.tie(NULL);
using namespace std;
int main() { maymaythanghuyen; ll t; cin>>t; while(t--) { ll n; cin>>n; ll s=sqrt(n); if(s*s!=n){ cout<<0; } else { for(ll i=1;i<=s;i++) {
}
pragma GCC optimize("O2")
pragma GCC target("avx,avx2,fma")
include <bits/stdc++.h>
using namespace std;
define Hormer_Nguyen signed main()
define int long long
define file(name) if (fopen(name".inp", "r")) { freopen(name".inp", "r", stdin); freopen(name".out", "w", stdout); }
const int maxn=5+1e6; int n,t; void ans(int n) { long long c=sqrt((long double)n); if (cc!=n) { cout<<0<<endl; return; } int sum=1; if (n%16==0) { n/=16; int x=sqrt(n); for (int i=2;i<=sqrt(x);i++) { int cnt=0; while (x%i==0) { cnt++; x/=i; }sum=(cnt+1); }if (x>1) sum*=2; cout<<sum<<endl; }else cout<<0<<endl; } HormerNguyen { ios::syncwith_stdio(false); cin.tie(0); cin>>t; while (t--) { cin>>n; ans(n); } }
Ùm, có lẽ thông tin này hữu ích cho các bạn bị WA:) Bài này tính cả cặp a,b với a=b:))))
This comment is hidden due to too much negative feedback. Show it anyway.
This comment is hidden due to too much negative feedback. Show it anyway.
This comment is hidden due to too much negative feedback. Show it anyway.
This comment is hidden due to too much negative feedback. Show it anyway.
This comment is hidden due to too much negative feedback. Show it anyway.
This comment is hidden due to too much negative feedback. Show it anyway.
This comment is hidden due to too much negative feedback. Show it anyway.
This comment is hidden due to too much negative feedback. Show it anyway.
This comment is hidden due to too much negative feedback. Show it anyway.
This comment is hidden due to too much negative feedback. Show it anyway.
This comment is hidden due to too much negative feedback. Show it anyway.
This comment is hidden due to too much negative feedback. Show it anyway.
This comment is hidden due to too much negative feedback. Show it anyway.
This comment is hidden due to too much negative feedback. Show it anyway.
This comment is hidden due to too much negative feedback. Show it anyway.
This comment is hidden due to too much negative feedback. Show it anyway.
This comment is hidden due to too much negative feedback. Show it anyway.
Who are u? Why have I never heard of you?
This comment is hidden due to too much negative feedback. Show it anyway.
This comment is hidden due to too much negative feedback. Show it anyway.
This comment is hidden due to too much negative feedback. Show it anyway.
This comment is hidden due to too much negative feedback. Show it anyway.
Cho em hỏi tại sao lại phải đếm số ước vậy ạ
This comment is hidden due to too much negative feedback. Show it anyway.
This comment is hidden due to too much negative feedback. Show it anyway.