2014年1月10日

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

2014年1月7日

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)

2014年1月3日

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

2014年1月2日

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)

uva 10785 - The Mad Numerologist

摘要: 这题就是计算元音和辅音的个数,放到两个容器里,再按字典序排序一开始漏写了个辅音,错了一次 1 #include 2 #include 3 #include 4 using namespace std; 5 int main(){ 6 int n; 7 cin>>n; 8 vector v_vowel; 9 vector v_consonants;10 char vowel[5]={'A','U','E','O','I'};11 char consonants[21]={'J',' 阅读全文

posted @ 2014-01-02 20:57 云在心 阅读(137) 评论(0) 推荐(0)

uva 755 - 487--3279

摘要: 算法是蛮简单的,不过超时了 1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7 using namespace std; 8 vector v_number; 9 vector v_num;10 int main(){11 int n;12 cin>>n;13 string l;14 getchar();15 char CmapN[100];16 CmapN['A']=CmapN['B']=CmapN['C']='2';17 CmapN 阅读全文

posted @ 2014-01-02 19:32 云在心 阅读(289) 评论(0) 推荐(0)

2013年12月31日

uva 10194 - Football (aka Soccer)

摘要: 又是wa,有点搞不懂 1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7 using namespace std; 8 typedef struct infoteam{ 9 string name; 10 int games; 11 int point; 12 int win; 13 int tie; 14 int lose; 15 int difference; 16 int score; 17 int against;... 阅读全文

posted @ 2013-12-31 10:42 云在心 阅读(196) 评论(0) 推荐(0)

导航