码迷,mamicode.com
首页 > 其他好文 > 详细

LA UVaLive 6628 Grachten (水题,数学)

时间:2016-08-21 00:57:14      阅读:131      评论:0      收藏:0      [点我收藏+]

标签:

题意:给定一个平面图形并且且给了几条连,求一条。

析:简单么,三角形相似,很简单就AC。

代码如下:

#pragma comment(linker, "/STACK:1024000000,1024000000")
#include <cstdio>
#include <string>
#include <cstdlib>
#include <cmath>
#include <iostream>
#include <cstring>
#include <set>
#include <queue>
#include <algorithm>
#include <vector>
#include <map>
#include <cctype>
#include <stack>
using namespace std;

typedef long long LL;
typedef pair<int, int> P;
const int INF = 0x3f3f3f3f;
const double inf = 0x3f3f3f3f3f3f;
const double PI = acos(-1.0);
const double eps = 1e-8;
const int maxn = 10 + 5;
const int mod = 1e9 + 7;
const char *mark = "+-*";
const int dr[] = {-1, 0, 1, 0};
const int dc[] = {0, 1, 0, -1};
int n, m;
inline bool is_in(int r, int c){
    return r >= 0 && r < n && c >= 0 && c < m;
}

int main(){
    int ac, ab, bd;
    while(scanf("%d %d %d", &ab, &ac, &bd) == 3){
        int x = ab*ac;
        int y = bd-ac;
        int g = __gcd(x, y);
        printf("%d/%d\n", x/g, y/g);
    }
    return 0;
}

  

 

LA UVaLive 6628 Grachten (水题,数学)

标签:

原文地址:http://www.cnblogs.com/dwtfukgv/p/5791587.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!