QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#556052#9248. An Easy Math ProblemSLF666#TL 0ms3604kbC++20814b2024-09-10 14:39:462024-09-10 14:39:51

Judging History

This is the latest submission verdict.

  • [2024-10-31 22:36:43]
  • hack成功,自动添加数据
  • (/hack/1098)
  • [2024-10-31 22:13:58]
  • hack成功,自动添加数据
  • (/hack/1096)
  • [2024-10-31 22:00:43]
  • hack成功,自动添加数据
  • (/hack/1095)
  • [2024-09-10 14:39:51]
  • Judged
  • Verdict: TL
  • Time: 0ms
  • Memory: 3604kb
  • [2024-09-10 14:39:46]
  • Submitted

answer

#include<bits/stdc++.h>
using namespace std;

#define endl "\n"
#define ll long long
map<pair<ll,ll>,int> mp;
vector<ll> q;
ll n;
void solve(){
	cin >> n;
	mp.clear();
	q.clear();
	ll i;
	for(i = 1 ; i * i <= n; i ++){
		if(n % i == 0){
			ll j = n / i ;
			q.push_back(i);
			if(i == j)continue;
			q.push_back(j);
		}
	}
	for(int i = 0 ; i < q.size() ; i ++){
		for(int j = 0 ; j < q.size() ; j ++){
		    ll x = q[i],  y = q[j];
		    if(n % (x * y) == 0){
		    	if(x > y)swap(x , y);
		    	ll tmp = __gcd(x , y);
		    	x /= tmp , y /= tmp;
		    	mp[{x, y}] = 1; 
			}
		}
	}
	cout << mp.size() << endl;
}

signed main(){
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);
	int t = 1;
	cin>>t;
	for(int i=1;i<=t;i++){
		solve();
	}
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

10
1
2
3
4
5
6
7
8
9
10

output:

1
2
2
3
2
5
2
4
3
5

result:

ok 10 lines

Test #2:

score: -100
Time Limit Exceeded

input:

2000
6469693230
6469693230
6469693230
6469693230
6469693230
6469693230
6469693230
6469693230
6469693230
6469693230
6469693230
6469693230
6469693230
6469693230
6469693230
6469693230
6469693230
6469693230
6469693230
6469693230
6469693230
6469693230
6469693230
6469693230
6469693230
6469693230
646969323...

output:


result: