QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#595388 | #9245. Bracket Sequence | DBsoleil# | WA | 1ms | 4392kb | C++20 | 784b | 2024-09-28 13:36:13 | 2024-09-28 13:36:14 |
Judging History
answer
#include<bits/stdc++.h>
#define pb push_back
using namespace std;
typedef long long ll;
const int N=1e5+5;
int T,isp[N];
ll n;
vector<ll> pr;
void sieve(int n)
{
for(int i=2;i<=n;i++)
{
if(!isp[i]) pr.pb(i);
for(ll p:pr)
{
if(p*i>n) break;
isp[p*i]=1;
if(i%p==0) break;
}
}
//cerr<<pr.size();
}
ll work(ll n)
{
if(n==1) return 1;
ll ans=1;
for(int p:pr)
{
int cnt=0;
while(n%p==0) n/=p,cnt++;
ans*=(cnt+cnt+1);
}
if(n!=1) ans*=3;
return (ans+1)/2;
}
void solve()
{
scanf("%lld",&n);
printf("%lld\n",work(n));
}
int main()
{
sieve(1e5);
scanf("%d",&T);
while(T--) solve();
}
详细
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 4392kb
input:
5 20 (()() 1 1 2 1 1 1 3 1 1 1 4 1 1 1 5 1 1 2 3 1 1 2 4 1 1 2 5 1 1 3 4 1 1 3 5 1 1 4 5 1 2 1 3 1 2 1 4 1 2 1 5 1 2 2 3 1 2 2 4 1 2 2 5 1 2 3 5 1 2 4 5 1 1 1 5 2 2 1 5 2
output:
8 8 8 8 8
result:
wrong answer 1st lines differ - expected: '0', found: '8'