2018CCPC吉林赛区(重现赛)
作者:互联网
http://acm.hdu.edu.cn/contests/contest_show.php?cid=867
A题,直接分块,不知道正解是什么。
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll sum(int n){
ll ans=0;
for(ll l=1,r;l<=n;l=r+1){
r=n/(n/l);
ans+=(r-l+1)*(n/l);
}
return ans;
}
int main() {
#ifdef Yinku
freopen("Yinku.in", "r", stdin);
//freopen("Yinku.out", "w", stdout);
#endif // Yinku
int q;
while(~scanf("%d", &q)) {
for(int qi = 1; qi <= q; qi++) {
int n;
scanf("%d", &n);
printf("Case %d: %s\n", qi, sum(n) & 1 ? "odd" : "even");
}
}
}
标签:cn,show,正解,赛区,ll,long,2018CCPC,重现,ans 来源: https://www.cnblogs.com/Yinku/p/11194344.html