QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#771067#9248. An Easy Math Problem401rk8#AC ✓6ms3816kbC++171.5kb2024-11-22 09:31:122024-11-22 09:31:12

Judging History

你现在查看的是最新测评结果

  • [2024-11-22 09:31:12]
  • 评测
  • 测评结果:AC
  • 用时:6ms
  • 内存:3816kb
  • [2024-11-22 09:31:12]
  • 提交

answer

#include <bits/stdc++.h>
#include <bits/extc++.h>
using namespace std; using namespace __gnu_pbds; using namespace __gnu_cxx;
#define For(i,x,y,...) for(int i=x,##__VA_ARGS__;i<=(y);++i)
#define Rep(i,x,y,...) for(int i=x,##__VA_ARGS__;i<(y);++i)
#define rFor(i,x,y,...) for(int i=x,##__VA_ARGS__;i>=(y);--i)
#define pb emplace_back
#define sz(a) int((a).size())
#define all(a) (a).begin(),(a).end()
#define fi first
#define se second
#define mkp make_pair
typedef long long LL; typedef vector<int> Vi; typedef pair<int,int> Pii;
auto ckmax=[](auto &x,auto y) { return x<y ? x=y,true : false; };
auto ckmin=[](auto &x,auto y) { return y<x ? x=y,true : false; };
sfmt19937 mt(chrono::steady_clock::now().time_since_epoch().count());
int rnd(int l,int r) { return uniform_int_distribution<>(l,r)(mt); }
template<typename T=int>T read() { T x; cin>>x; return x; }

LL n;
vector<LL> p;

void sieve() {
	const int n = 1e5;
	bitset<n+1> vis;
	For(i,2,n) {
		if( !vis[i] ) p.pb(i);
		for(int j = 0; i*p[j] <= n; ++j) {
			vis[i*p[j]] = 1;
			if( !(i % p[j]) ) break;
		}
	}
}

void MAIN() {
    cin>>n;
	LL ans = 1;
	for(int i = 0; i < sz(p) && p[i]*p[i] <= n; ++i) if( !(n % p[i]) ) {
		int cnt = 0;
		for(; !(n % p[i]); n /= p[i]) ++cnt;
		ans *= 2 * cnt + 1;
	}
	if( n > 1 ) ans *= 3;
	cout<<(ans+1)/2<<'\n';
} signed main() {
#ifdef FS
    freopen("in","r",stdin); freopen("out","w",stdout);
#endif
    ios::sync_with_stdio(0);cin.tie(0);
	sieve();
    int lft=read(); while( lft-- ) {
        MAIN();
    }
    return 0;
}

这程序好像有点Bug,我给组数据试试?

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

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: 1ms
memory: 3816kb

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

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
5
2
5
23
95
68
14
8
68
203
14
23
32
38
41
8
8
14
2
608
41
158
338
23
41
14
5
14
41
14
203
41
14
17
446
5
53
59
878
2
14
365
203
14
203
2
122
32
95
41
41
5
23
14
41
5
5
14
122
23
203
608
23
41
122
2
14
95
2
68
41
203
14
230
41
68
23
50
14
32
14
8
5
5
5
68
68
122
293
473
5
41
41
14
2
14
14
5
2
122
...

result:

ok 2000 lines

Extra Test:

score: 0
Extra Test Passed