首页 > 其他分享 >poj-2707

poj-2707

时间:2023-05-23 16:02:36浏览次数:43  
标签:oy int double 2707 ox poj dx dy


//408K  0MS G++
#include <cstdio>
#include <cstring>

using namespace std;

int oX;
int oY;

int dX;
int dY;

inline double MIN(double a, double b) {
    return a < b ? a: b;
}

inline double MAX(double a, double b) {
    return a > b ? a: b;
}

void solve(int ox, int oy, int dx, int dy) {
    double case1x = (dx >= ox) ? 1.0 : (double)dx/ox;
    double case1y = (dy >= oy) ? 1.0 : (double)dy/oy;

    double case1 = MIN(case1x, case1y);

    double case2x = (dy >= ox) ? 1.0 : (double)dy/ox;
    double case2y = (dx >= oy) ? 1.0 : (double)dx/oy;

    double case2 = MIN(case2x, case2y);

    printf("%d%%\n", (int)(MAX(case1, case2)*100));

}

int main() {
    while(scanf("%d %d %d %d", &oX, &oY, &dX, &dY) != EOF) {
        if (!oX && !oY && !dX && !dY) {
            return 0;
        }
        solve(oX, oY, dX, dY);
    }
}



水水更健康,就两种放法,找最大的就可以,这道题不能四舍五入。



标签:oy,int,double,2707,ox,poj,dx,dy
From: https://blog.51cto.com/u_9420214/6332981

相关文章

  • poj-2635
    //1652K875MSG++1000//1648K1313MSG++10000#include<stdio.h>#include<string.h>#include<math.h>#include<stdlib.h>constintMAX=1000100;charnotPrime[MAX+1];intPrimeNum;intPrimes[MAX];voidcheckPrim......
  • poj-3286
    //stupidmethod!!!!!!!!!!!!!!!//388K360MSG++#include<stdio.h>#include<string.h>#include<math.h>intC[33][33];//C[n][m],choosemfromn;voidgetCombination(){for(intn=0;n<=32;n++){for(intm=......
  • poj-2282
    //380K 32MS G++#include<stdio.h>#include<string.h>#include<math.h>longlongappearTime1[10];longlongappearTime2[10];voidgetAppearTime(intnum,longlong*appearArray){ appearArray[0]=1; if(num==0){ return; }......
  • poj-2249
    //356K16MSG++//356K0MSG++addm==0check//356K16MSG++//356K0MSG++addm==0check#include<stdio.h>#include<string.h>#include<math.h>intm;intn;//voidgetNum(unsignedintn,unsignedintm){//......
  • poj-1037
    //196K16MSC++#include<cstdio>#include<cstring>usingnamespacestd;constintMAX=25;longlongDP[MAX][MAX][2];//0:down.1:upvoidinit(){for(intcurPlankNum=1;curPlankNum<=20;curPlankNum++){for(......
  • poj-2140
    //132K 110MS C++#include<cstring>#include<cstdio>usingnamespacestd;intN;longlongcnt;voidsolve(intN){ intbegin=1; intend=1; longlongsum=1; while(1){ if(begin>N){ break; } //if(begin==......
  • poj-1988
    //564K 282MS C++#include<cstdio>#include<cstring>#include<iostream>usingnamespacestd;structUF_Node{ intup; intcount; intparent;};typedefstructUF_NodeUF_Node;UF_NodeUF_Array[30001];voidcreat(){ intc; for(......
  • poj-1693
    //136K 0MS C++#include<cstdio>#include<cstring>structLine{ intbx,ex; intby,ey;};typedefstructLineLine;LinehLine[110];LinevLine[110];intcaseNum;intLineNum;boolinsect(Line&vline,Line&hline){ //pr......
  • POJ1737 Connected Graph ( n点无向连通图计数
    题意说明:求\(n\)个点的无向连通图个数据说已经非常典了,但是我太菜了不会组合数学,最近补档时看到这道题,决定记录下来理理思路......
  • POJ--1163 The Triangle(DP)
    记录10:432023-5-15http://poj.org/problem?id=1163reference:《挑战程序设计竞赛(第2版)》第二章练习题索引p135DescriptionFigure1showsanumbertriangle.Writeaprogramthatcalculatesthehighestsumofnumberspassedonaroutethatstartsatthetopa......