2014年1月27日

uva 10110 - Light, more light

摘要: 这题题目中有个单词打错了害我题意理解了好几天,只能打dota2消遣,其中 “whose serial is divisable by i ” 其实是 "whose serial is divisible by i "这题要注意的地方是 2^32 -1 , 整个题目很简单就判断一个数是否是完全平方数 1 #include 2 #include 3 using namespace std; 4 int main(){ 5 unsigned long n; 6 while(cin>>n){ 7 if(!n) 8 break; 9 ... 阅读全文

posted @ 2014-01-27 14:52 云在心 阅读(170) 评论(0) 推荐(0)

2014年1月23日

uva 575 - Skew Binary

摘要: 这是一题进制转换问题,因为最大为2^31-1,所以只要建立一个数组把2^1-1 到2^31-1先保存就是一个很简单的问题 1 #include 2 #include 3 #include 4 using namespace std; 5 int main(){ 6 long long kth[32]; 7 kth[0]=1; 8 for(int i=1;i<32;i++){ 9 kth[i]=(kth[0]=kth[0]<<1)-1;10 }11 string temp;12 while(getline(cin,temp)){1... 阅读全文

posted @ 2014-01-23 11:27 云在心 阅读(161) 评论(0) 推荐(0)

2014年1月21日

uva Maths - Number Theory

摘要: http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=100这是将要做的题目的网址,上一章还有几题没做出来,先不管了,开始新的一章,数论,希望能一切顺利 阅读全文

posted @ 2014-01-21 16:57 云在心 阅读(90) 评论(0) 推荐(0)

uva 10014 - Simple calculations

摘要: 尼玛,这题太搞了,已经推出公式了,还是不对,看了网上正确的代码也没发现自己错的地方,尼玛这是网上的 1 #include 2 #include 3 void main() 4 {double c[3001],s[3001],x,y; 5 int n,i,t; 6 scanf("%d",&t); 7 while (t--) 8 { 9 scanf("%d",&n);10 scanf("%lf%lf",&x,&y);11 for (i=1;i 2 #include 3 using namespace std 阅读全文

posted @ 2014-01-21 16:45 云在心 阅读(156) 评论(0) 推荐(0)

2014年1月13日

uva 10970 - Big Chocolate

摘要: 水题。。。1 #include2 using namespace std;3 int main(){4 int m,n;5 while(cin>>m>>n){6 cout<<m-1+(n-1)*m<<endl;7 }8 } 阅读全文

posted @ 2014-01-13 10:20 云在心 阅读(86) 评论(0) 推荐(0)

2014年1月12日

uva 10177 - (2/3/4)-D Sqr/Rects/Cubes/Boxes?

摘要: 感觉这是一道纯数学题,正好复习了一下平方和公式以及立方和公式4次方和没有查到只能用计算机来做,为了好看,我平方和以及立方和也用for来做,运行速度还是挺快的,这里要注意由于数比较大很可能越界,所以要用longlong 1 #include 2 using namespace std; 3 long long n4[101]; 4 long n3[101]; 5 long n2[101]; 6 int main(){ 7 n4[0]=n3[0]=n2[0]=0; 8 for(int i=1;i>N){17 long long temp=(N+1)*N/2;18 ... 阅读全文

posted @ 2014-01-12 20:58 云在心 阅读(157) 评论(0) 推荐(0)

2014年1月11日

uva 10719 - Quotient Polynomial

摘要: 1 #include 2 #include 3 #include 4 #include 5 #include 6 using namespace std; 7 int a[10000]; 8 int b[10000]; 9 int main(){10 int k;11 while(cin>>k){12 getchar();13 string l;14 getline(cin,l);15 istringstream iss(l);16 int i=0;17 for(string te... 阅读全文

posted @ 2014-01-11 10:56 云在心 阅读(167) 评论(0) 推荐(0)

2014年1月10日

uva 11044 - Searching for Nessy

摘要: 水题中的水题。。。。#includeusing namespace std;int main(){ int n,m; int t; cin>>t; while(t--){ cin>>n>>m; int temp1=n/3; int temp2=m/3; cout<<temp1*temp2<<endl; }} 阅读全文

posted @ 2014-01-10 21:33 云在心 阅读(98) 评论(0) 推荐(0)

uva 10790 - How Many Points of Intersection?

摘要: 这题方法很简单,但是要注意数据类型要用longlong,题目中给出了是64bit的 1 #include 2 using namespace std; 3 int main(){ 4 long a,b,temp=1; 5 while(cin>>a>>b){ 6 if(!a&&!b) 7 break; 8 long long sum=1; 9 if(a<2||b<2){10 cout<<"Case "<<temp++<<": 0"<<endl;11 cont 阅读全文

posted @ 2014-01-10 21:16 云在心 阅读(145) 评论(0) 推荐(0)

uva 10499 - The Land of Justice

摘要: 感觉很简单的一题,但是wa了两次,还是看了网上的代码才知道,虽然N是int型的,但是25*n就不一定是了,改成long就行了#includeusing namespace std;int main(){ long n; while(cin>>n){ if(n<0) break; if(n==1){ cout<<"0%"<<endl; continue; } cout<<n*25<<"%"<<endl; }} 阅读全文

posted @ 2014-01-10 20:18 云在心 阅读(135) 评论(0) 推荐(0)

导航