[ZJ]a647: 投資專家
題目:
http://zerojudge.tw/ShowProblem?problemid=a647
--------------------------------------------------------------------------------------------------------
#include<bits/stdc++.h>
using namespace std;
#define maxn 1e-9
int main()
{
int T;
scanf("%d",&T);
while(T--)
{
long double m, p;
scanf("%Lf %Lf", &m, &p);
long double ans = (p/m-1)*100;
if( ans > -maxn ) printf("%.2Lf%% ", ans+maxn);
else printf("%.2Lf%% ", ans-maxn);
if( p/m-1 > 0.1-maxn || p/m-1 < -0.07+maxn) puts("dispose");
else puts("keep");
}
}
http://zerojudge.tw/ShowProblem?problemid=a647
--------------------------------------------------------------------------------------------------------
#include<bits/stdc++.h>
using namespace std;
#define maxn 1e-9
int main()
{
int T;
scanf("%d",&T);
while(T--)
{
long double m, p;
scanf("%Lf %Lf", &m, &p);
long double ans = (p/m-1)*100;
if( ans > -maxn ) printf("%.2Lf%% ", ans+maxn);
else printf("%.2Lf%% ", ans-maxn);
if( p/m-1 > 0.1-maxn || p/m-1 < -0.07+maxn) puts("dispose");
else puts("keep");
}
}
留言
張貼留言