Advertisement
Guest User

Untitled

a guest
Nov 24th, 2014
165
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.21 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2.  
  3. using namespace std;
  4. int i,j,k,l,price[10],ans,p;
  5. double rto,area,x,y,z,x1,x2,yl,y2,z1,z2,hh[10],ww[10],h,w;
  6. int main()
  7. {
  8.     price[0]=319;
  9.     price[1]=419;
  10.     price[2]=450;
  11.     price[3]=519;
  12.     price[4]=599;
  13.     price[5]=600;
  14.     price[6]=630;
  15.     price[7]=719;
  16.     hh[0]=1024;
  17.     hh[1]=1024;
  18.     hh[2]=960;
  19.     hh[3]=2048;
  20.     hh[4]=1136;
  21.     hh[5]=1280;
  22.     hh[6]=1920;
  23.     hh[7]=1136;
  24.     ww[0]=768;
  25.     ww[1]=600;
  26.     ww[2]=640;
  27.     ww[3]=1536;
  28.     ww[4]=640;
  29.     ww[5]=800;
  30.     ww[6]=1080;
  31.     ww[7]=640;
  32.     while(scanf("%lf %lf",&h,&w)!=EOF)
  33.     {
  34.         if((h==0)&&(w==0))
  35.         {
  36.             break;
  37.         }
  38.         rto=0;
  39.         for(i=0;i<7;i++)
  40.         {
  41.             area=hh[i]*ww[i];
  42.             x1=hh[i];
  43.             z1=hh[i]/h;
  44.             yl=floor(w*z1);
  45.             z1=(x1*yl)/area;
  46.             x2=ww[i];
  47.             z2=ww[i]/h;
  48.             y2=floor(w*z2);
  49.             z2=(x2*y2)/area;
  50.             z=max(z1,z2);
  51.             if(rto<=z)
  52.             {
  53.                 rto=z;
  54.                 p=price[i];
  55.                 cout<<rto<<"  "<<i<<"  "<<p<<endl;
  56.             }
  57.         }
  58.         printf("%d\n",p);
  59.     }
  60.     return 0;
  61. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement