随笔分类 -  Maths-Misc

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 云在心 阅读(158) 评论(0) 推荐(0)

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 云在心 阅读(89) 评论(0) 推荐(0)

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 云在心 阅读(158) 评论(0) 推荐(0)

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 云在心 阅读(170) 评论(0) 推荐(0)

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 云在心 阅读(99) 评论(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 云在心 阅读(136) 评论(0) 推荐(0)

uva 846 - Steps
摘要:wa了两次才纠正,虽然想法对了,还是要自己先多测几组数据#include#includeusing namespace std;int main(){ int x,y; int n; cin>>n; while(n--){ cin>>x>>y; if(x==y){ cout<<"0"<<endl; continue; } int n = (int)sqrt((double)(y-x)); if(n==1) cout<<y-x<<endl... 阅读全文

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

uva 573 - The Snail
摘要:很简单,不过还是wa了几次,才做对#includeusing namespace std;int main(){ int h,speed,slide,per; while(cin>>h>>speed>>slide>>per){ if(!h&&!speed&&!slide&&!per) break; h*=100; speed*=100; slide*=100; int d=speed*per/100; int height=0; for(int i=0;;... 阅读全文

posted @ 2014-01-10 14:44 云在心 阅读(126) 评论(0) 推荐(0)

uva 107 - The Cat in the Hat
摘要:自己的写的太丑了,看了网上的才叫惊呆,太挫了用log做太简单了。。。 1 #include 2 #include 3 void main() 4 {int hight,num,left,right,mid,x,y; 5 while (scanf("%d%d",&hight,&num),hight+num) 6 { 7 left=1; right=10000000; 8 while (left) 9 {mid=(left+right)/2;10 if (fabs(log(mid)*log(hight)-log(mid+1)*log(num))0) right= 阅读全文

posted @ 2014-01-07 17:15 云在心 阅读(182) 评论(0) 推荐(0)

uva 591 - Box of Bricks
摘要:水题 1 #include 2 using namespace std; 3 int main(){ 4 int n; 5 int h[101]; 6 int temp=1; 7 while(cin>>n){ 8 int sum=0; 9 if(n==0)10 break;11 for(int i=0;i>h[i];13 sum+=h[i];14 }15 int ave=sum/n;16 sum=0;17 ... 阅读全文

posted @ 2014-01-03 16:11 云在心 阅读(113) 评论(0) 推荐(0)

uva 10025 - The ? 1 ? 2 ? ... ? n = k problem
摘要:这题乍看很难,其实一想就通了只要1+。。+n>=k这时候要填符号,就是 减去双倍的某个数所以1+..n减去k必为偶数 1 #include 2 #include 3 using namespace std; 4 int main(){ 5 int n; 6 cin>>n; 7 while(n--){ 8 int k; 9 cin>>k;10 if(k==0){11 cout=2*k&&((i+1)*i/2-k)%2==0){19 cout0)24 ... 阅读全文

posted @ 2014-01-03 15:56 云在心 阅读(101) 评论(0) 推荐(0)

uva 621 - Secret Research
摘要:水题不多说 1 #include 2 #include 3 #include 4 using namespace std; 5 int main(){ 6 int n; 7 cin>>n; 8 getchar(); 9 while(n--){10 string l;11 getline(cin,l);12 if(l=="1"||l=="4"||l=="78"){13 cout<<"+"<<endl;14 }15 else if(l[l.size()-1]=='... 阅读全文

posted @ 2014-01-03 14:32 云在心 阅读(107) 评论(0) 推荐(0)

uva 10161 - Ant on a Chessboard
摘要:这题很简单,记得输出是x y不是(x,y),还wa了一次 1 #include 2 #include 3 using namespace std; 4 int main(){ 5 int n; 6 while(cin>>n){ 7 if(n==0) 8 break; 9 if(n==1){10 coutnth*nth)?(nth+1):nth;15 int flag=nth%2;16 int temp=n-(nth-1)*(nth-1)-nth;17 ... 阅读全文

posted @ 2014-01-02 21:46 云在心 阅读(111) 评论(0) 推荐(0)

导航