Hdu 1018+1196+2504+2817+1042
来源:互联网 发布:tensorflow 遗传算法 编辑:程序博客网 时间:2024/05/17 22:05
最近实验室发生了一些事情……决定重新开始刷几天的水题,说不定也能碰到一些好题呢!
比较水的题目我就集合到一篇博文里用于代码记录了。
1018
http://acm.hdu.edu.cn/showproblem.php?pid=1018
#include <cstdio>#include <cmath>int main(){int T,n;scanf("%d",&T);while (T--){double sum=0;scanf("%d",&n);for (int i=1;i<=n;i++)sum+=log10(i*1.0);printf("%d\n",(int)sum+1);}return 0;}
1196
http://acm.hdu.edu.cn/showproblem.php?pid=1196
//这个题有好多算法的,最简单的应该是这个了吧……#include <cstdio>int main (){int n;while (scanf("%d",&n) , n)printf("%d\n",n&-n);return 0;}
2504
http://acm.hdu.edu.cn/showproblem.php?pid=2504
#include <cstdio>int Gcd (int x,int y) { return !y?x:Gcd(y,x%y); }int main (){int T;scanf("%d",&T);while (T--){int a,b,c;scanf("%d%d",&a,&b);c=a/b;for (int i=2;;i++)if (b!=b*i && Gcd(c,i)==1)break;c=b*i;printf("%d\n",c);}return 0;}
2817
http://acm.hdu.edu.cn/showproblem.php?pid=2817
#include <cstdio>const int Mod=200907;__int64 a,b,c,k;void Deal1 (){__int64 d=(b-a)%Mod;k=(k-1)%Mod;a%=Mod;a=(a+k*d)%Mod;printf("%I64d\n",a);}void Deal2 (){__int64 q=(c/b)%Mod;k--;if (k<8)while (k-->0)a=((a%Mod)*(q%Mod))%Mod;elsewhile (k>0){__int64 q2=q,cnt=2;while (cnt<k){q2=(q2*q2)%Mod;cnt*=2;}k-=cnt/2;a=(a*q2)%Mod;}printf("%I64d\n",a);}int main (){int T;scanf("%d",&T);while (T--){scanf("%I64d%I64d%I64d%I64d",&a,&b,&c,&k);if (b-a == c-b)Deal1 ();elseDeal2 ();}return 0;}
1042
http://acm.hdu.edu.cn/showproblem.php?pid=1042
#include <cstdio>#include <cstring>const int N=8000;int data[8005];int main (){ int n; while (~scanf("%d",&n)) { int i,j; memset(data,0,sizeof(data)); data[0]=1; for (i=2;i<=n;i++) { for (j=0;j<N;j++) data[j]*=i; for (j=0;j<N;j++) { data[j+1]+=data[j]/100000; data[j]%=100000; } } for (i=N;i>=0;i--) if (data[i]!=0) break; printf("%d",data[i]); for (i--;i>=0;i--) printf("%05d",data[i]); printf("\n"); } return 0;}
- Hdu 1018+1196+2504+2817+1042
- hdu 2817
- hdu 2504
- hdu 2504
- hdu 2504
- HDU 2504
- hdu 2504
- hdu 1196
- hdu 1196
- hdu 1196
- HDU 1196
- HDU 1196
- hdu 1196
- HDU-1196
- hdu 1196
- HDU 1196
- hdu 1196
- HDU 1042
- httpclient4.2.2的几个常用方法,登录之后访问页面问题,下载文件
- 读书小记《headfirst javascript》
- 如何中把excel表中的数据用sql语句导入到数据表中
- android界面View简介及android界面绘制过程
- OANET(五):编译安装Qt-Embedded
- Hdu 1018+1196+2504+2817+1042
- 动态提交表单
- 浅谈数据库及表设计的几个原则
- Accurately Say "CocaCola"!
- 写给4年前开始编程序的自己
- Libpcap使用总结
- ThreadLocal memory leak
- android中dip、dp、px、sp和屏幕密度简介
- 生产者模式实现总结