QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#549990#9248. An Easy Math Problemucup-team3555#TL 0ms3604kbC++20518b2024-09-07 08:25:192024-09-07 08:25:20

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-07 08:25:20]
  • Judged
  • Verdict: TL
  • Time: 0ms
  • Memory: 3604kb
  • [2024-09-07 08:25:19]
  • Submitted

answer

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

const int N=1e5+5;
ll n,p[N],c[N],cnt=0,ans=0;

void SOLVE(){
  cin>>n;ll x=n;cnt=ans=1;
  for(int i=2;i*i<=n;i++){
	if(x%i==0){
	  p[++cnt]=i,c[cnt]=0;
      while(x%i==0) ++c[cnt],x/=i;
	}
  }
  if(x>1) p[++cnt]=x,c[cnt]=1;

  for(int i=1;i<=cnt;i++)
	ans=ans*(2ll*c[i]+1);
  cout<<(ans+1)/2ll<<'\n';
}

int main(){
  ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
  int _;cin>>_;
  while(_--) 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: