1 条题解
-
0
C :
#include <stdio.h> int max(int a,int b) { return a > b ? a : b; } int main() { int a,b; while(~scanf("%d%d",&a,&b)) { int c; c = 6 - max(a,b); if(c == 0) printf("1/6\n"); else if(c == 1) printf("1/3\n"); else if(c == 2) printf("1/2\n"); else if(c == 3) printf("2/3\n"); else if(c == 4) printf("5/6\n"); else printf("1/1\n"); } }
C++ :
#include<cstdio> #include<cstdlib> #include<cstring> #include<cctype> #include<cmath> #include<algorithm> #include<iostream> #include<string> #include<vector> #include<bitset> #include<queue> #include<stack> #include<list> #include<map> #include<set> #define TEST #define LL long long #define Mt(f, x) memset(f, x, sizeof(f)); #define rep(i, s, e) for(int i = (s); i <= (e); ++i) #ifdef TEST #define See(a) cout << #a << " = " << a << endl; #define See2(a, b) cout << #a << " = " << a << ' ' << #b << " = " << b << endl; #define debug(a, s, e) rep(_i, s, e) {cout << a[_i] << ' ';} cout << endl; #define debug2(a, s, e, ss, ee) rep(i_, s, e) {debug(a[i_], ss, ee)} #else #define See(a) #define See2(a, b) #define debug(a, s, e) #define debug2(a, s, e, ss, ee) #endif // TEST const int MAX = 2e9; const int MIN = -2e9; const double eps = 1e-8; const double PI = acos(-1.0); using namespace std; int gcd(int a, int b) { return b ? gcd(b, a % b) : a; } int main() { int a, b; // freopen("in.txt", "r", stdin); // freopen("out.txt", "w", stdout); while(~scanf("%d%d", &a, &b)) { int c = max(a, b); int fz = 6 - c + 1; int fm = 6; int g = gcd(fz, fm); fz /= g; fm /= g; printf("%d/%d\n", fz, fm); } return 0; }
- 1
信息
- ID
- 3537
- 时间
- 1000ms
- 内存
- 128MiB
- 难度
- (无)
- 标签
- 递交数
- 0
- 已通过
- 0
- 上传者