QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#641296#9248. An Easy Math Problemhansue#WA 0ms3704kbC++141.3kb2024-10-14 19:42:262024-10-14 19:42:27

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-10-14 19:42:27]
  • Judged
  • Verdict: WA
  • Time: 0ms
  • Memory: 3704kb
  • [2024-10-14 19:42:26]
  • Submitted

answer

#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<vector>
using namespace std;

void print(__int128 num)
{
	if(num>9) 
		print(num/10);
	putchar(num%10+'0');
}

typedef long long LL;
const LL N = (LL)1e10;
const LL Nt = 1e5;

	vector<LL>list;
	bool isp[Nt + 3];

void shai(){
	list.clear();
	memset(isp, -1, sizeof isp);
	for(LL i = 2; i * i <= Nt; i++){
		if(isp[i]){
			list.push_back(i);
			for(int j = 0; j < list.size() && list[j] * i <= Nt; j++)
				isp[list[j] * i] = false;
		}
		else {
			for(int j = 0; j < list.size() && list[j] * i <= Nt; j++){
				isp[list[j] * i] = false;
				if(i % list[j] == 0)
					continue;
			}
		}
	}
//	for(int i = 0; i < list.size(); i++)
//		printf("%d ", list[i]);
}

	LL n,m;
	LL p[Nt],c[Nt];
	__int128 tmp,ans;
	


void divide(LL nn){
	m=0;
	for(int i = 0, p0; i < list.size(); i++){
		p0 = list[i];
		if(nn%p0==0){
			p[++m]=p0,c[m]=0;
			while(nn%p0==0) nn/=p0,c[m]++;
		}
	}
	if(nn>1)
	    p[++m]=nn,c[m]=1;
}

int main(){
	shai();
	
	int T; cin>>T;
	while(T--){
		cin>>n;
		divide(n);
		tmp=1,ans=1;
		p[0]=1,c[0]=1;
		for(int i=1;i<=m;i++) tmp*=c[i]+1;
		for(int i=1;i<=m;i++){
			ans*=(2*c[i]+1);
		}
		
		
		ans=(ans-1)/2+1;
		print(ans);
		cout<<endl;
	}
	return 0;

}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

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: 0
Accepted
time: 0ms
memory: 3636kb

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:

29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
...

result:

ok 2000 lines

Test #3:

score: -100
Wrong Answer
time: 0ms
memory: 3704kb

input:

2000
1763047095
79735483
1016286871
2864801397
2327774116
2668010360
3469893354
3634459021
1613699068
781737219
574741575
2763134701
1458502604
1822260248
2281150332
2924219311
2493931196
3735904708
158802001
2006921221
729928782
1974841034
727412600
2873393292
1291087179
2741607663
1893408215
29827...

output:

14
2
2
5
8
32
68
5
8
23
203
14
23
11
38
41
8
8
5
2
608
14
158
338
8
14
14
5
5
14
5
203
14
5
17
149
5
53
59
878
2
5
365
68
14
203
2
122
11
32
14
41
2
8
14
41
5
5
5
122
23
68
608
23
14
122
2
14
95
2
68
5
203
14
230
41
68
23
50
14
32
5
8
5
5
2
68
23
122
293
158
5
41
41
5
2
14
14
5
2
41
41
32
68
14
2
5
...

result:

wrong answer 2nd lines differ - expected: '5', found: '2'