CF707C(Codeforces Round #368 (Div. 2) - C)
来源:互联网 发布:淘宝专业版一钻以上 编辑:程序博客网 时间:2024/05/27 14:14
Problem : Pythagorean Triples
Description : 给出一个数字,要你求出另外的两个数使得这三个数构成勾股数。
Solution : 公式题,知道公式就可以做,不知道那就放弃吧。
Code(JAVA) :
import java.util.Scanner;public class Main { Scanner cin = new Scanner(System.in); public Main() { while (cin.hasNext()) { long n = cin.nextLong(); if (n < 3) System.out.println(-1); else if (n % 2 == 0) System.out.println((n * n / 4 - 1) + " " + (n * n / 4 + 1)); else System.out.println((n * n - 1) / 2 + " " + (n * n + 1) / 2); } } public static void main(String[] args) { new Main(); }}
0 0
- CF707C(Codeforces Round #368 (Div. 2) - C)
- Codeforces Round #368 (Div. 2) C
- Codeforces Round #368 (Div. 2) A C
- 【Codeforces Round #368 (Div. 2)】Codeforces 707C Pythagorean Triples
- 【codeforces】Codeforces Round #370 (Div. 2) C
- Codeforces Round #368 (DIV 2)
- Codeforces Round #368 (Div. 2)
- Codeforces Round #368 (Div. 2)
- Codeforces Round #368 (Div. 2)
- Codeforces Round #368 (Div. 2)
- Codeforces Round #368 (Div. 2)
- Codeforces Round #368 (Div. 2)
- Codeforces Round #368 (Div. 2)
- Codeforces Round #368 (Div.2)
- Codeforces Round #368 (Div. 2)
- Codeforces Round #368 (Div. 2)
- Codeforces Round #368 (Div. 2)
- Codeforces Round #368 (Div. 2) -- C. Pythagorean Triples (数学公式)
- CNTK学习笔记 -- Introduction
- 程序员之所以犯错误,不是因为他们不懂,而是因为他们自以为什么都懂。
- struts.xml(二)<action>使用详解
- Java基础之(三十七)Java多线程编程<一>
- 编程之道
- CF707C(Codeforces Round #368 (Div. 2) - C)
- Java 中 == 比较的是什么?
- 如何部署JSP应用到阿里云服务器上(二)
- Linux下的find指令(文件查找)用法
- 跳转界面的工具类
- Xamarin Android提示内存溢出错误
- JZOJ4735【NOIP2016提高A组模拟8.24】最小圈 Spfa深搜判负环
- #127 Topological Sorting
- BroadcastReceiver应用详解