codeforces-743C-math
来源:互联网 发布:疯狂java讲义的错误 编辑:程序博客网 时间:2024/06/10 10:53
题目大意:给定n,求满足2/n=1/x+1/y+1/z的x,y,z的值
题目解析:想到1/a+1/(a+1)+1/(a*a+a)=2/a,所以我们只要令x=a,y=a+1,z=a*a+a即可,注意n=1的时候y=z不可以;
AC代码:
#include<iostream>#include<cstdio>#include<algorithm>#include<cstring>#include<string>using namespace std;typedef long long ll;const int inf=0x3fffffff;int main(){int n;while(scanf("%d",&n)!=EOF){if(n==1){printf("-1\n");continue;}int a,b,c;a=n;b=n+1;c=n*(n+1);printf("%d %d %d\n",a,b,c);}return 0;}
0 0
- codeforces-743C-math
- [CodeForces 490C]Hacking Cypher[math]
- [CodeForces 552C]Vanya and Scales[math]
- codeforces-729C-bindary search,math
- Codeforces Beta Round #32 (Div. 2) C (math+思维)
- Problem - 409C - Codeforces(brute force + math)
- Codeforces Round #328 (Div. 2) C. The Big Race (math)
- codeforces 303C Minimum Modular(下标的艺术+math)
- codeforces-50A-A. Domino piling ( C && greedy && math )
- math.c
- Codeforces Round #295 (Div. 2) C. DNA Alignment ACM解题报告(math)
- codeforces--650A Watchmen(math)
- Codeforces 492E (math)
- codeforces 846B Math Show
- Codeforces 846 B MAth Show
- Codeforces Eyad and Math Gym
- Codeforces 846B Math Show
- codeforces 182D KMP+math
- 注解系列知识总结(一)
- 超文本传输协议版本 2 [http/2 spec]
- 类的继承
- 动态创建顺序表,并进行插入删除操作
- C++必须使用【初始化列表】初始化数据成员的三种情况
- codeforces-743C-math
- 我也来学设计模式_策略模式
- 为什么使用正则test( )第一次是 true,第二次是false?
- Internet Transaction Server (ITS) mobile – Developing ITS templates from scratch
- IE这个大坑之细数遇到的坑
- Spring MVC + MyBatis3 实现的简单个人博客
- codevs4思路
- Heap Viewer
- 将Gridview的item项设置成正方形