gym224647B

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了gym224647B相关的知识,希望对你有一定的参考价值。

鏍囩锛?a href='http://www.mamicode.com/so/1/system' title='system'>system   sys   algo   include   浜х敓   lld   print   amp   骞抽潰   

gym224647B

棰樻剰锛?/h3>

鍦ㄤ簩缁村钩闈腑路閫夊嚭涓€涓潰绉渶灏忕殑涓夎褰紝杈撳嚭杩欎釜涓夎褰㈤潰绉殑涓ゅ€嶃€?/p>

瑙f硶锛?/h3>

棣栧厛锛屾渶浼樿В涓€瀹氬湪鐩搁偦鏈€杩戠殑涓変釜鐐逛腑浜х敓銆?br /> 鐒跺悗鎴戜滑灏卞彲浠ョ敤鍚戦噺姹備笁瑙掑舰鐨勯潰绉€?/p>

CODE:

#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>

using namespace std;

#define LL long long
const int N = 4e5 + 10;
const LL MAX = 9223372036854775805;

struct Vec  
    LL x , y; 
 p[N];

inline LL labs(LL x)  
    return x < 0 ? - x : x ; 

inline LL calc(Vec a , Vec b)  
    return labs (a.x * b.y - a.y * b.x); 

LL ans = MAX,n;

int main () 
    scanf("%lld",&n); 
    for(int i = 1 ; i <= n ; i++) 
        scanf("%lld%lld",&p[i].x,&p[i].y);
        p[i + n] = p[i];
    
    for(int i = 1 ; i <= n ; i++) 
        int j = i + 1,k = j + 1 ; // i - j , k - j 
        Vec a,b;
        a.x = p[i].x - p[j].x; 
        a.y = p[i].y - p[j].y;
        b.x = p[k].x - p[j].x; 
        b.y = p[k].y - p[j].y;
        LL res = calc(a,b) ;
        if(res != 0) ans = min(ans,res);
    
    printf("%lld\n",ans); 
    //system("pause");
    return 0 ;

以上是关于gym224647B的主要内容,如果未能解决你的问题,请参考以下文章

Gym Gym 101147G 第二类斯特林数

OpenAI Gym 入门与提高 Gym环境构建与最简单的RL agent

强化学习 平台 openAI 的 gym 安装 (Ubuntu环境下如何安装Python的gym模块)

openai/gym 中各种环境(Env)的参数解释

2016 USP-ICMC-Codeforces-Gym101063C-Sleep Buddies Gym101063F-Bandejao Gym101063J-The Keys

gym 搭建 RL 环境