QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#665280#9248. An Easy Math ProblemwysunWA 4ms3616kbC++17776b2024-10-22 10:48:532024-10-22 10:48:53

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-22 10:48:53]
  • Judged
  • Verdict: WA
  • Time: 4ms
  • Memory: 3616kb
  • [2024-10-22 10:48:53]
  • Submitted

answer

#include<iostream>
#include<vector>

using namespace std;

typedef pair<int,int> PII;
typedef long long LL;

int main()
{
	int T;
	cin>>T;
	
	while(T --)
	{
		LL n;
		cin>>n;
		
		vector<PII> v;
		for(int i=2;i<=n/i;i++)
		{
			int cnt = 0;
			while(n % i == 0)
			{
				n/=i;
				cnt ++;
			}
			
			if(cnt) v.push_back({i,cnt});
		}
		
		if(n != 1) v.push_back({n,1});
		
		LL sum = 1;
		for(auto x : v)
		{
			LL a = x.second;
			sum *= (a+1);
		}
		
		for(int i = 0;i < v.size(); i++)
		{
			LL res = v[i].second;
			int  x = v[i].first;
			
			bool f = 0;
			for(int j=i+1;j<v.size();j++)
			{
				res *= (v[j].second+1);
				f = 1;
			}
			
			if(f) sum += (res - 1);
		}
		
		cout<<sum<<endl;
	}
	
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

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: 4ms
memory: 3616kb

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'