QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#576606#9248. An Easy Math ProblemAmiyaCastWA 0ms3584kbC++141.2kb2024-09-19 21:14:212024-09-19 21:14:21

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-19 21:14:21]
  • Judged
  • Verdict: WA
  • Time: 0ms
  • Memory: 3584kb
  • [2024-09-19 21:14:21]
  • Submitted

answer

#include<bits/stdc++.h>
#define ll long long
#define pii make_pair
#define pb push_back
#define rep(i,a,b) for(int i=a;i<=b;++i)
#define per(i,b,a) for(int i=b;i>=a;--i)
const ll inf = 1145141919810;
using namespace std;
inline ll read() {
	ll x=0,f=1;
	char c=getchar();
	while (c<'0' || c>'9') {
		if (c=='-')  f=-1;
		c=getchar();
	}
	while (c>='0' && c<='9') {
		x=x*10+c-'0';
		c=getchar();
	}
	return x*f;
}
inline void print(ll x) {
	if(x < 0) putchar('-'), x = -x;
	if(x > 9) print(x / 10);
	putchar(x % 10 + '0');
	return ;
}
inline void pprint(ll x) {
	print(x);
	puts("");
}
void slv() {
	ll n = read();
	vector<pair<int, int> >q;
	ll nn = n;
	for(int i = 2; i * i <= n; ++i) {
		if(n % i == 0) {
			q.pb(pii(i, 0));
			while(n % i == 0) {
				n /= i;
				q[(int)q.size() - 1].second++;
			}
		}
	}
	if(n > 1) q.pb(pii(n, 1));
	n = nn;
	ll ans = 1ll;
	for(auto zys:q) {
		ll x = zys.first, y = zys.second;
		ans *= (y + 2) * (y + 1) / 2;
	}
	
	ll ans2 = 0ll;
	for(ll i = 1; i * i <= n; ++i){
		if(n % (i * i) == 0) ans2++;
	}
	
	pprint((ans - ans2) / 2 + 1);
}
int main() {
	int T = read();
	while(T--) {
		slv();
	}
	return 0;
}



Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3584kb

input:

10
1
2
3
4
5
6
7
8
9
10

output:

1
2
2
3
2
5
2
5
3
5

result:

wrong answer 8th lines differ - expected: '4', found: '5'