首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > 编程 >

Regionals 2012, Asia - Jakarta 答题报告

2013-09-05 
Regionals 2012, Asia - Jakarta 解题报告啥都不会做了。。 做题慢死A.Grandpas Walk签到题。直接DFS就行。注

Regionals 2012, Asia - Jakarta 解题报告

啥都不会做了。。 

做题慢死

A.Grandpa's Walk

签到题。

直接DFS就行。

注意先判断这个点可以作为一个路径的起点不。

然后再DFS。 

否则处理起来略麻烦

#include <iostream>#include <cstdio>#include <set>#include <vector>#include <cstring>#include <algorithm>#define INF 100000005#define MAXN 70000using namespace std;int f(int x1, int y1, int x2, int y2){    return x1 * y2 - y1 * x2;}int main(){    int T, cas = 0;    int x1, x2, y1, y2, x3, y3;    scanf("%d", &T);    while(T--)    {        scanf("%d%d%d%d%d%d", &x1, &y1, &x2, &y2, &x3, &y3);        int a = f(x1, y1, x2, y2);        int b = f(x1, y1, x3, y3);        int c = f(x2, y2, x3, y3);        printf("Case #%d: %d\n", ++cas, __gcd(abs(a), __gcd(abs(b), abs(c))));    }    return 0;}


J.Perfect Matching

貌似最裸的暴力是能在oj上过的。

但是从现场的感觉来看

不应该是那么裸才是

1楼ACM_cxlove前天 15:16
为何您这么神

热点排行