日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

【数学】Hunter’s Apprentice

發布時間:2025/3/8 编程问答 25 豆豆
生活随笔 收集整理的這篇文章主要介紹了 【数学】Hunter’s Apprentice 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

題目描述

When you were five years old, you watched in horror as a spiked devil murdered your parents. You would?have died too, except you were saved by Rose, a passing demon hunter. She ended up adopting you and?training you as her apprentice.
Rose’s current quarry is a clock devil which has been wreaking havoc on the otherwise quiet and unassuming?town of Innsmouth. It comes out each night to damage goods, deface signs, and kill anyone foolish enough?to wander around too late. The clock devil has offed the last demon hunter after it; due to its time-warping?powers, it is incredibly agile and fares well in straight-up fights.
The two of you have spent weeks searching through dusty tomes for a way to defeat this evil. Eventually, you?stumbled upon a relevant passage. It detailed how a priest managed to ensnare a clock devil by constructing?a trap from silver, lavender, pewter, and clockwork. The finished trap contained several pieces, which must?be placed one-by-one in the shape of a particular polygon, in counter-clockwise order. The book stated that?the counter-clockwise order was important to counter the clock devil’s ability to speed its own time up, and?that a clockwise order would only serve to enhance its speed.
It was your responsibility to build and deploy the trap, while Rose prepared for the ensuing fight. You?carefully reconstruct each piece as well as you can from the book. Unfortunately, things did not go as?planned that night. Before you can finish preparing the trap, the clock devil finds the two of you. Rose tries?to fight the devil, but is losing quickly. However, she is buying you the time to finish the trap. You quickly?walk around them in the shape of the polygon, placing each piece in the correct position. You hurriedly?activate the trap as Rose is knocked out. Just then, you remember the book’s warning. What should you?do next?

?

輸入

The first line of input contains a single integer T (1 ≤ T ≤ 100), the number of test cases. The first line of?each test case contains a single integer n (3 ≤ n ≤ 20), the number of pieces in the trap. Each of the next?n lines contains two integers xi and yi (|xi |, |yi | ≤ 100), denoting the x and y coordinates of where the ith?piece was placed. It is guaranteed that the polygon is simple; edges only intersect at vertices, exactly two?edges meet at each vertex, and all vertices are distinct.

?

輸出

For each test case, output a single line containing either fight if the trap was made correctly or run if the?trap was made incorrectly.

?

樣例輸入

復制樣例數據

2 3 0 0 1 0 0 1 3 0 0 0 1 1 0

樣例輸出

fight run

?

提示

In the first case, you went around the polygon in the correct direction, so it is safe to fight the clock devil
and try to save Rose.
In the second case, you messed up, and it is time to start running. Sorry Rose!

?

題目大意:

先輸入一個整數t,下面有t組測試,對于每組測試,先輸入一個整數n,然后按順序輸入n個點的坐標,這些點能圍成一個多邊形,最后根據若是按順時針轉,則輸出run,否則輸出fight。

解題思路:

這題是要求多邊形的順逆時針的問題,其實就是通過一個模板直接判斷,知道這個模板的話非常簡單,此題可以通過Green公式求解多邊形順逆時針來解。

代碼:

#include <cstdio> #include <iostream> #include <algorithm> #include <cmath> #include <cstdlib> #include <cstring> #include <map> #include <stack> #include <queue> #include <vector> #include <bitset> #include <set> #include <utility> #include <sstream> #include <iomanip> using namespace std; typedef long long ll; typedef unsigned long long ull; #define inf 0x3f3f3f3f #define rep(i,l,r) for(int i=l;i<=r;i++) #define lep(i,l,r) for(int i=l;i>=r;i--) #define ms(arr) memset(arr,0,sizeof(arr)) //priority_queue<int,vector<int> ,greater<int> >q; const int maxn = (int)1e5 + 5; const ll mod = 1e9+7; struct node {double x,y; }arr[100]; int main() {#ifndef ONLINE_JUDGEfreopen("in.txt", "r", stdin);#endif//freopen("out.txt", "w", stdout);ios::sync_with_stdio(0),cin.tie(0);int t;cin>>t;while(t--) {int n;cin>>n;rep(i,1,n) cin>>arr[i].x>>arr[i].y;double nape=0;rep(i,1,n-1) {nape+=(-0.5)*(arr[i+1].x-arr[i].x)*(arr[i+1].y+arr[i].y); //Green公式}nape+=(-0.5)*(arr[1].x-arr[n].x)*(arr[1].y+arr[n].y);if(nape<0) cout<<"run"<<endl;else cout<<"fight"<<endl;}return 0; }

?

總結

以上是生活随笔為你收集整理的【数学】Hunter’s Apprentice的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。

主站蜘蛛池模板: 国产精品一区二区三区久久久 | 中文在线免费看视频 | 免费啪视频 | 十八岁世界在线观看高清免费韩剧 | 视频一区在线播放 | 亚洲国产aⅴ精品一区二区的游戏 | 国产视频精品一区二区三区 | 色视频网站在线观看 | 嫩草影院中文字幕 | 人人爱超碰 | 台湾色综合 | 啪视频免费 | 人人爽爽爽 | 毛片毛片毛片毛片毛片毛片毛片毛片 | 特级毛片在线播放 | 色哟哟一区二区三区 | 黄瓜视频在线免费看 | 人妻熟女aⅴ一区二区三区汇编 | 国产精品一二三级 | 影音先锋激情 | 亚洲第一大综合区 | 日韩午夜精品 | 国产亚洲综合精品 | 欧美成人精品在线视频 | 国产成人精品亚洲日本在线观看 | 亚洲色图1| 91国内| 91麻豆精品国产91久久久久久 | 奇米狠狠去啦 | 午夜小视频在线播放 | 亚洲做受高潮无遮挡 | 人人人妻人人澡人人爽欧美一区 | 日韩免费小视频 | 蜜桃av噜噜一区二区三区 | 免费人妻精品一区二区三区 | 久久久久久国产精品日本 | 久久免费在线视频 | 69久久精品无码一区二区 | 国产免费内射又粗又爽密桃视频 | 性一交一乱一色一视频麻豆 | 精品黑人一区二区三区观看时间 | 在线资源av| www.xxxx国产 | 激情女主播| 国产又粗又猛又爽又黄的视频一 | 狠狠插影院| 在线国产不卡 | 可以直接看的毛片 | 免费99精品国产自在在线 | 精品爆乳一区二区三区无码av | 妻色成人网 | 成人欧美一级特黄 | 岛国片免费在线观看 | 久久丝袜美腿 | 国产99久久九九精品无码 | 五月开心激情网 | 野花社区视频在线观看 | 麻豆回家视频区一区二 | 精品国产美女 | 国产一级免费视频 | 干b视频在线观看 | 国产av一区二区三区传媒 | 国产1区2区 | 成人久久国产 | 久草av在线播放 | 日韩成人免费电影 | 天天插夜夜操 | 欧美国产日韩在线视频 | v99av| 欧美视频在线看 | 欧美色偷偷| 日本伊人网 | 婷婷天堂 | 激情午夜av | 用我的手指扰乱你 | 久久成人综合 | 免费一级片网址 | 日本精品久久久久久 | 精品久久一二三区 | 色视频免费在线观看 | 波多野结衣久久 | 第一色影院 | 性激烈视频在线观看 | 国产一国产二国产三 | 99久久久无码国产精品免费 | 国产123区| 尤物视频免费观看 | 国产强伦人妻毛片 | 一色道久久88加勒比一 | 国产传媒一区二区三区 | 日韩成年人视频 | 男女涩涩网站 | 免费av视屏| 国产盗摄av | 亚欧洲精品在线视频免费观看 | 男女男精品视频网站 | 91免费网站入口 | 日韩国产91 | 中文字幕av无码一区二区三区 |