403. Scientific Problem

Time limit per test: 0.25 second(s)

Memory limit: 65536 kilobytes
input: standard

output: standard

Once upon a time Professor Idioticideasinventor was travelling by train. Watching cheerless landscape outside the window, he decided to invent the theme of his new scientific work. All of a sudden a brilliant idea struck him: to develop an effective algorithm
finding an integer number, which is x times less than the sum of all its integer positive predecessors, where number x is given. As far as he has no computer in the train, you have to solve this difficult problem.

Input

The first line of the input file contains an integer number x (1 ≤ x ≤ 109).

Output

Output an integer number — the answer to the problem.

Example(s)
sample input
sample output
1
3
sample input
sample output
2
5


Online Contester Team © 2002 - 2010. All rights reserved.

思路:先给出一个数x。求出数n,使得n是n之前全部数(不包含n)的总和的1/x

由求和公式n*(n-1)/2/x = n 可得 n=2*x+1



AC代码:

#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std; int main() {
int x;
while(scanf("%d", &x) != EOF) {
printf("%d\n", 2*x+1);
}
return 0;
}

SGU - 403 - Scientific Problem (水)的更多相关文章

  1. SGU 403 Scientific Problem

    403. Scientific Problem Time limit per test: 0.25 second(s)Memory limit: 65536 kilobytes input: stan ...

  2. 找规律 SGU 107 987654321 problem

    题目地址:http://acm.sgu.ru/problem.php?contest=0&problem=107 /* 题意:n位数的平方的后面几位为987654321的个数 尼玛,我看描述这 ...

  3. SGU 107 987654321 problem【找规律】

    题目链接: http://acm.sgu.ru/problem.php?contest=0&problem=107 题意: 平方后几位为987654321的n位数有多少个 分析: 虽然说是水题 ...

  4. SGU 205. Quantization Problem

    205. Quantization Problem time limit per test: 0.25 sec. memory limit per test: 65536 KB input: stan ...

  5. hdu-5867 Water problem(水题)

    题目链接: Water problem Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Othe ...

  6. Poj1207 The 3n + 1 problem(水题(数据)+陷阱)

    一.Description Problems in Computer Science are often classified as belonging to a certain class of p ...

  7. Codeforces - 1194B - Yet Another Crosses Problem - 水题

    https://codeforc.es/contest/1194/problem/B 好像也没什么思维,就是一个水题,不过蛮有趣的.意思是找缺黑色最少的行列十字.用O(n)的空间预处理掉一维,然后用O ...

  8. CodeForces 706C Hard problem (水DP)

    题意:对于给定的n个字符串,可以花费a[i]  将其倒序,问是否可以将其排成从大到小的字典序,且花费最小是多少. 析:很明显的水DP,如果不是水DP,我也不会做.... 这个就要二维,d[2][max ...

  9. sgu 107 987654321 problem

    其实挺水的,因为两个数平方,只有固定的后面几位数会影响到最后结果的后面几位数.也就是说,如果想在平方之后尾数为987654321,那么就有固定的几个尾数在平方后会是这个数,打个表,发现 10^8 内 ...

随机推荐

  1. C# Autofac 出现 尝试创建“XXController”类型的控制器时出错。请确保控制器具有无参数公共构造函数 错误解决方案

    出现以下错误: 总结解决方案: 本项目采用构造函数方法进行依赖注入,由于个人原因在业务层相互注入了接口,导致交叉:报错

  2. unity多语言本地化

    简介 嗯...一般来说做游戏啥的都不会只发一个国家,但是每个国家语言不同,就存在多语言本地化的问题,然后直接用过一个通过xml完成本地化的东东,然后策划反馈不会修改xml,扔给我一个excel让我自己 ...

  3. Linq学习(零)-错误汇总

    问题一: Cannot execute text selection: CS0009 Metadata file 'C:\Users\Kimisme\Documents\LINQPad Plugins ...

  4. 6.10---springboot的配置

  5. 话说:Hibernate二级缓存

    Hibernate缓存分类: 一.Session缓存(又称作事务缓存):Hibernate内置的,不能卸除. 缓存范围:缓存只能被当前Session对象访问.缓存的生命周期依赖于Session的生命周 ...

  6. git的使用注意事项

    这里仅记录了下自己在初次使用git来管理项目的时候遇到的一些注意事项,记录下来备忘以下,以免下次又在这里花太多时间. 1. centos下面已经支持yum install git.来安装. 2. 安装 ...

  7. 慕课网中网页定位导航中js相关问题总结

    <!DOCTYPE html> <html> <head> <meta charset="utf-8"/> <title> ...

  8. Puppeteer——自动化脚本设计

    我被分配了一个繁琐的任务,就是要给100个相同的站点做同样的配置.曾经就有做过相同的事,那时还不会写脚本,全靠手动配置.机械的配置了两天的时间,身体感觉被掏空.所以这次我决定还是写一个脚本自动的进行配 ...

  9. 6、scala Map和Tuple

    1.  创建Map 2.访问Map元素 3.修改Map元素的值 4.遍历Map 5.SortedMap和LinkedHashMap 6.Map的元素类型Tuple 1.  创建Map 创建不可变的Ma ...

  10. dotfuscator 如何设置