QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#641101#9248. An Easy Math ProblemTytytony#WA 1ms5636kbC++23701b2024-10-14 18:32:352024-10-14 18:32:38

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 18:32:38]
  • Judged
  • Verdict: WA
  • Time: 1ms
  • Memory: 5636kb
  • [2024-10-14 18:32:35]
  • Submitted

answer

#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#define ll long long
#define N 1000010
using namespace std;

ll n,m;
ll p[N],c[N];
ll tmp,ans;

void divide(ll nn){
	m=0;
	for(int i=2;i*i<=nn;i++){
		if(nn%i==0){
			p[++m]=i,c[m]=0;
			while(nn%i==0) nn/=i,c[m]++;
		}
	}
	if(nn>1)
	    p[++m]=nn,c[m]=1;
}

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

}

详细

Test #1:

score: 100
Accepted
time: 1ms
memory: 5608kb

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
Wrong Answer
time: 0ms
memory: 5636kb

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:

2037
2037
2037
2037
2037
2037
2037
2037
2037
2037
2037
2037
2037
2037
2037
2037
2037
2037
2037
2037
2037
2037
2037
2037
2037
2037
2037
2037
2037
2037
2037
2037
2037
2037
2037
2037
2037
2037
2037
2037
2037
2037
2037
2037
2037
2037
2037
2037
2037
2037
2037
2037
2037
2037
2037
2037
2037
2037
2037
2037
...

result:

wrong answer 1st lines differ - expected: '29525', found: '2037'