【Codeforces Round #239 (Div. 1) A】Triangle
Codeforces div round Triangle
2023-09-14 09:03:45 时间
【链接】 我是链接,点我呀:)
【题意】
【题解】
最后的直角三角形可以通过平移,将直角顶点移动到坐标原点。 然后我们只要枚举另外两个点其中一个点的坐标就好了。 x坐标的范围是[1..a) 因为再长的话,这条边肯定就超过边长a了。 然后用一些相似三角形的规律就能知道另外一个点的坐标了。 看看这两个点的y坐标是不是一样就好。【代码】
#include <bits/stdc++.h>
using namespace std;
int a,b;
int main(){
#ifdef LOCAL_DEFINE
freopen("rush_in.txt", "r", stdin);
#endif
ios::sync_with_stdio(0),cin.tie(0);
cin >> a >> b;
for (int i = 1;i < a;i++){
int x = i;
int y = sqrt(a*a-x*x);
if (y*y+x*x==a*a && b*y%a==0 && b*x%a==0 && b*x/a!=y){
cout<<"YES"<<endl;
cout<<"0 0"<<endl;
cout<<x<<' '<<y<<endl;
cout<<-b*y/a<<' '<<b*x/a<<endl;
return 0;
}
}
cout<<"NO"<<endl;
return 0;
}
相关文章
- Codeforces Round #277(Div. 2) (A Calculating Function, B OR in Matrix, C Palindrome Transformation)
- 【Codeforces Round #693 (Div. 3) E】Correct Placement
- 【Codeforces Round #223 (Div. 1) C】Sereja and Brackets
- 【Codeforces Round #639 (Div. 2) D】Monopole Magnets
- 【Codeforces Round #635 (Div. 2) B】Kana and Dragon Quest game
- 【Codeforces Round #247 (Div. 2) C】k-Tree
- 【Codeforces Round #636 (Div. 3) D】Constant Palindrome Sum
- 【Educational Codeforces Round 53 (Rated for Div. 2) C】Vasya and Robot
- 【Codeforces Round #505 (rated, Div. 1 + Div. 2, based on VK Cup 2018 Final) B】Weakened Common Divisor
- 【Codeforces Round #476 (Div. 2) [Thanks, Telegram!] D】Single-use Stones
- 【Codeforces Round #450 (Div. 2) A】Find Extra One
- 【Codeforces Round #453 (Div. 2) A】 Visiting a Friend
- 【Codeforces Round #452 (Div. 2) A】 Splitting in Teams
- 【Codeforces Round #445 (Div. 2) D】Restoration of string
- 【Codeforces Round #442 (Div. 2) B】Nikita and string
- 【Codeforces Round #440 (Div. 2) A】 Search for Pretty Integers
- 【Codeforces Round #432 (Div. 1) C】 Arpa and a game with Mojtaba
- 【Codeforces Round #429 (Div. 2) C】Leha and Function
- 【 Codeforces Round #425 (Div. 2) D】Misha, Grisha and Underground
- 【Codeforces Round #423 (Div. 2) B】Black Square
- 【Codeforces Round #422 (Div. 2) A】I'm bored with life
- Codeforces Round #274 (Div. 2)
- Codeforces Round #296 (Div. 2) B. Error Correct System
- Codeforces Round #256 (Div. 2) 题解
- Codeforces Round #277 (Div. 2) 题解
- Codeforces Round #440 (Div. 2, based on Technocup 2018 Elimination Round 2)
- Codeforces Round #204 (Div. 2)
- 树状数组 Playrix Codescapes Cup (Codeforces Round #413, rated, Div. 1 + Div. 2) C. Fountains
- 补题:Codeforces Round 858 (Div. 2) C. Sequence Master
- 赛后补题:Codeforces Round #843 (Div. 2) 1775C. Interesting Sequence