2 条题解
-
4huhe (huangjiasheng) LV 9 @ 2021-11-29 19:19:46
/***************************************** 备注: ******************************************/ #include <queue> #include <math.h> #include <stack> #include <stdio.h> #include <iostream> #include <vector> #include <iomanip> #include <string.h> #include <algorithm> using namespace std; #define ll long long const int N = 1e5 + 10; const int INF = 0x3f3f3f3f; #define dd double int main() { ll n, a, b; dd x, y; cin >> n; cin >> a >> b; x = (double)b/a; for (int i=1; i<n; i++){ cin >> a >> b; y = (double)b/a; if ((y-x) > 0.05) cout << "better" << endl; else if ((x-y) > 0.05) cout << "worse" << endl; else cout << "same" << endl; } return 0; }
-
22022-1-11 9:12:59@
#include <iostream> using namespace std; int main() { int n,i,j,s[20][2]; double haart; scanf("%d",&n); for(i=0;i<n;i++) for(j=0;j<2;j++) scanf("%d",&s[i][j]); haart=(double)s[0][1]/s[0][0]; for(i=1;i<n;i++) { if((double)s[i][1]/s[i][0]-haart>0.05) { printf("better\n"); continue; } if(haart-(double)s[i][1]/s[i][0]>0.05) { printf("worse\n"); continue; } printf("same\n"); } return 0; }
- 1
信息
- ID
- 913
- 时间
- 1000ms
- 内存
- 128MiB
- 难度
- 3
- 标签
- 递交数
- 125
- 已通过
- 64
- 上传者