2011年7月14日

sicily 1051. Biker's Trip Odomete

摘要: #include <iostream>#include<stdio.h>#include<cmath>using namespace std;#define pi acos(-1.0)int main(){ int n=1; double d,r,t; while(cin>>d>>r>>t,r) { printf("Trip #%d: %.2f %.2f\n",n++, r*d*pi/63360 , r*d*pi*3600/(63360*t) ); } return 0;} 阅读全文

posted @ 2011-07-14 19:32 sysu_mjc 阅读(204) 评论(0) 推荐(0) 编辑

sicily 1793. Numbers

摘要: #include<iostream>#include<cmath>using namespace std;int gcd(int a,int b){ int r; while(b>0) { r=a%b; a=b;b=r; } return a;}int main(){ int a,b,c; while(cin>>a>>b&&a) { c=b/a; for(int i=sqrt(double(c));i>=1;--i) if(c%i==0&&gcd(c/i,i)==1) { cout<<a*( 阅读全文

posted @ 2011-07-14 19:22 sysu_mjc 阅读(133) 评论(0) 推荐(0) 编辑

sicily 1784. Road Toll

摘要: //应用Dijkstra算法,分别以扣费后剩下的钱,和扣费的数额作为路径计量#include<iostream> //Dijkstra算法#include<stdio.h>#include<cstring>using namespace std;double table[110][110],ans[110]; //ans[]记录从起点到该点扣完费后剩下的最大钱数bool S[110];int main(){ int cases,n,a,b,i,j; cin>>cases; while(cases--) { cin>>n>> 阅读全文

posted @ 2011-07-14 19:13 sysu_mjc 阅读(170) 评论(0) 推荐(0) 编辑

sicily 1783. Large is Better

摘要: #include<iostream>#include<algorithm>#include<functional>#include<cstring>usingnamespacestd;intmain(){charch[200];intcases;cin>>cases;while(cases--){cin>>ch;ints,t,len=strlen(ch);for(s=0;s<len;++s)if(ch[s]!='0')break;for(t=s;t<len;++t)if(ch[t]==' 阅读全文

posted @ 2011-07-14 16:48 sysu_mjc 阅读(210) 评论(0) 推荐(0) 编辑

sicily 1327. Pinary

摘要: #include<iostream> //递推关系#include<cstring>using namespace std;int ans[1000],sum[1000],out[1000];int main(){ ans[1]=ans[2]=1; sum[1]=1;sum[2]=2; int r=2; while(sum[r]<90000000) { ++r; ans[r]=ans[r-1]+ans[r-2]; sum[r]=ans[r]+sum[r-1]; } int cases,n,i,res[1000],t; cin>>cases; while 阅读全文

posted @ 2011-07-14 15:53 sysu_mjc 阅读(226) 评论(0) 推荐(0) 编辑

导航