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

歡迎訪問 生活随笔!

生活随笔

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

编程问答

CodeForces - 1058D D. Vasya and Triangle

發布時間:2023/12/15 编程问答 36 豆豆
生活随笔 收集整理的這篇文章主要介紹了 CodeForces - 1058D D. Vasya and Triangle 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

D. Vasya and Triangle
time limit per test1 second
memory limit per test256 megabytes
inputstandard input
outputstandard output
Vasya has got three integers n, m and k. He’d like to find three integer points (x1,y1), (x2,y2), (x3,y3), such that 0≤x1,x2,x3≤n, 0≤y1,y2,y3≤m and the area of the triangle formed by these points is equal to nmk.

Help Vasya! Find such points (if it’s possible). If there are multiple solutions, print any of them.

Input
The single line contains three integers n, m, k (1≤n,m≤109, 2≤k≤109).

Output
If there are no such points, print “NO”.

Otherwise print “YES” in the first line. The next three lines should contain integers xi,yi — coordinates of the points, one point per line. If there are multiple solutions, print any of them.

You can print each letter in any case (upper or lower).

Examples
inputCopy
4 3 3
outputCopy
YES
1 0
2 3
4 1
inputCopy
4 4 7
outputCopy
NO
Note
In the first example area of the triangle should be equal to nmk=4. The triangle mentioned in the output is pictured below:

In the second example there is no triangle with area n*m/k=16/7.


不要被他給的圖迷惑,這就是個水題。

include<iostream> using namespace std; int main() {long long int n,m,k,i;cin>>n>>m>>k;if((n*m)%(2*k)!=0){cout<<"NO";return 0;}for(i=1;i<=m;i++){if((n*i)==(2*n*m)/k){cout<<"YES"<<endl;cout<<0<<' '<<0<<endl;cout<<0<<' '<<n<<endl;cout<<n<<' '<<i<<endl;return 0;}}for(i=1;i<=n;i++){if((m*i)==(2*n*m)/k){cout<<"YES"<<endl;cout<<0<<' '<<0<<endl;cout<<0<<' '<<m<<endl;cout<<0<<' '<<i<<endl;return 0;}} }

總結

以上是生活随笔為你收集整理的CodeForces - 1058D D. Vasya and Triangle的全部內容,希望文章能夠幫你解決所遇到的問題。

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