哈理工多校算法赛三
A 不凡的夫夫:https://www.nowcoder.com/acm/contest/75#question
#include <bits/stdc++.h> #define PI 3.1415926535 using namespace std; int main() { int t; scanf("%d",&t); while(t--) { double n,e=exp(1); scanf("%lf",&n); int ans=log(sqrt(2*n*PI))/log(8)+n*log(n/e)/log(8); if(n) printf("%d\n",ans+1); else printf("1\n"); } return 0; }
斯特林公式 http://blog.csdn.net/zuzhiang/article/details/79256738
B 一个小问题:https://www.nowcoder.com/acm/contest/75/B
中国剩余定理 https://www.cnblogs.com/MashiroSky/p/5918158.html
待解
C 守护白起:https://www.nowcoder.com/acm/contest/75/C
待解
D 小牛VS小客:https://www.nowcoder.com/acm/contest/75/D
#include <bits/stdc++.h> using namespace std; int main() { long long n; while(~scanf("%lld",&n)) { if(n<=2) printf("XiaoNiu\n"); else printf("XiaoKe\n"); } return 0; }
博弈 待解
E 进击把!阶乘:https://www.nowcoder.com/acm/contest/75/E
#include <bits/stdc++.h> using namespace std; int a[10005]; int main() { int n; while(~scanf("%d",&n)) { int index=0; a[0]=1; for(int i=2;i<=n;i++) { int temp=0; for(int j=0;j<=index;j++) { a[j]=a[j]*i+temp; /// 将前一位存入的temp加进来 temp=a[j]/10000; /// 如123456 将12存入temp a[j]%=10000; /// 3456 仍在原位 } if(temp>0) a[++index]=temp; /// 本轮乘后 超出原有的长度 新加一位 } printf("%d",a[index]); for(int i=index-1;i>=0;i--) { if(a[i]>=1000) printf("%d",a[i]); else if(a[i]>=100) printf("0%d",a[i]); else if(a[i]>=10) printf("00%d",a[i]); else printf("000%d",a[i]); } printf("\n"); } return 0; }
F 小牛再战:https://www.nowcoder.com/acm/contest/75/F
#include <bits/stdc++.h> using namespace std; int main() { int n; while(~scanf("%d",&n)&&n) { int cnt[105],maxa=0,i,num; memset(cnt,0,sizeof(cnt)); for(i=0;i<n;i++) { scanf("%d",&num); cnt[num]++; maxa=max(num,maxa); } for(i=1;i<=maxa;i++) if(cnt[i]%2) break; if(i>maxa) printf("Lose\n"); else printf("Win\n"); } return 0; }
博弈 待解
G 大水题:https://www.nowcoder.com/acm/contest/75/G
#include <bits/stdc++.h> using namespace std; int main() { long long n; while(~scanf("%lld",&n)) { long long uni; uni=(n/2)+(n/5)+(n/11)+(n/13) -(n/2/5)-(n/2/11)-(n/2/13)-(n/5/11)-(n/5/13)-(n/11/13) +(n/2/5/11)+(n/2/5/13)+(n/5/11/13)+(n/2/11/13)-(n/2/5/11/13); printf("%lld\n",n-uni); } return 0; }
容斥定理
H 向左走:https://www.nowcoder.com/acm/contest/75/H
待解
I 三角形:https://www.nowcoder.com/acm/contest/75/I
题解 http://blog.csdn.net/zuzhiang/article/details/79256738
向量和求面积https://www.cnblogs.com/xiexinxinlove/p/3708147.html
皮克定理 待解