http://codeforces.com/contest/716/problem/C

题目大意:感觉这道题还是好懂得吧。

思路:不断的通过列式子的出来了。首先我们定义level=i, uplevel = i + 1,目前的uplevel,然后我们可以知道,之前求出来的restgrade%level = 0,于是我们可以列出一个式子sqrt(k1 * i + grade) = uplevel * k.因为grade也是i的倍数,假定grade = k2 * i,所以我们写成sqrt((k1 + k2) * i) = uplevel * k,所以两边平方再移项以后就可以发现总有这样的一个解满足条件,即:k1 = level * uplevel * uplevel - k2。然后我们打表一下:

//看看会不会爆int!数组会不会少了一维!
//取物问题一定要小心先手胜利的条件
#include <bits/stdc++.h>
using namespace std;
#define LL long long
#define ALL(a) a.begin(), a.end()
#define pb push_back
#define mk make_pair
#define fi first
#define se second
#define haha printf("haha\n") int main(){
LL n;
LL level = , grade = ;
LL k1, k2, k;
scanf("%I64d", &n);
for (LL uplevel = ; uplevel <= n + ; uplevel++){
k2 = grade / level;
///printf("k2 = %I64d\n", k2);
k1 = level * uplevel * uplevel - k2;
grade = sqrt((k1 + k2) * level);
///printf("grade = %I64d %I64d %I64d\n", grade, grade / level , uplevel);
level++;
printf("%I64d\n", k1);
}
return ;
}

我们发现grade总等于level * uplevel,所以我们就可以求得level,然后看到level=1的时候不满足条件,然后特判一下就好了

//看看会不会爆int!数组会不会少了一维!
//取物问题一定要小心先手胜利的条件
#include <bits/stdc++.h>
using namespace std;
#define LL long long
#define ALL(a) a.begin(), a.end()
#define pb push_back
#define mk make_pair
#define fi first
#define se second
#define haha printf("haha\n") int main(){
LL n;
LL level = , grade = ;
LL k1, k2, k;
scanf("%I64d", &n);
cout << << endl;
for (LL i = ; i <= n; i++){
printf("%I64d\n", (i + ) * (i + ) * i - i + );
}
return ;
}

Codeforces Round #372 (Div. 2) C 数学的更多相关文章

  1. Codeforces Round #372 (Div. 2)

    Codeforces Round #372 (Div. 2) C. Plus and Square Root 题意 一个游戏中,有一个数字\(x\),当前游戏等级为\(k\),有两种操作: '+'按钮 ...

  2. Codeforces Round #372 (Div. 2) A .Crazy Computer/B. Complete the Word

    Codeforces Round #372 (Div. 2) 不知不觉自己怎么变的这么水了,几百年前做A.B的水平,现在依旧停留在A.B水平.甚至B题还不会做.难道是带着一种功利性的态度患得患失?总共 ...

  3. Codeforces 715A & 716C Plus and Square Root【数学规律】 (Codeforces Round #372 (Div. 2))

    C. Plus and Square Root time limit per test 2 seconds memory limit per test 256 megabytes input stan ...

  4. Codeforces 715B & 716D Complete The Graph 【最短路】 (Codeforces Round #372 (Div. 2))

    B. Complete The Graph time limit per test 4 seconds memory limit per test 256 megabytes input standa ...

  5. Codeforces 716A Crazy Computer 【模拟】 (Codeforces Round #372 (Div. 2))

    A. Crazy Computer time limit per test 2 seconds memory limit per test 256 megabytes input standard i ...

  6. Codeforces 716B Complete the Word【模拟】 (Codeforces Round #372 (Div. 2))

    B. Complete the Word time limit per test 2 seconds memory limit per test 256 megabytes input standar ...

  7. Codeforces Round #372 (Div. 1) A. Plus and Square Root 数学题

    A. Plus and Square Root 题目连接: http://codeforces.com/contest/715/problem/A Description ZS the Coder i ...

  8. A. Little C Loves 3 I Codeforces Round #511 (Div. 2) 【数学】

    题目: Little C loves number «3» very much. He loves all things about it. Now he has a positive integer ...

  9. Codeforces Round #549 (Div. 2) D 数学

    https://codeforces.com/contest/1143/problem/D 题意 有nk个城市,第1,k+1,2k+1,...,(n-1)k+1城市有餐厅,你每次能走l距离,a为起始位 ...

随机推荐

  1. GIAC全球互联网架构大会——互联网技术架构未来

    GIAC全球互联网架构大会是高可用架构技术社区推出的面向架构师.技术负责人及高端技术从业人员的技术架构大会.中国拥有全球最大的互联网用户及移动互联网用户,如何使用合适的架构来搭建互联网系统,是每一个互 ...

  2. HDU 1896 Stones (优先队列)

    Problem Description Because of the wrong status of the bicycle, Sempr begin to walk east to west eve ...

  3. 浙大 pat 1024题解

    1024. Palindromic Number (25) 时间限制 400 ms 内存限制 32000 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue A ...

  4. nginx在linux下的目录结构

    配置文件目录 putty 下  whereis nginx /etc/nginx

  5. Entity Framework Code First -- Migrations 迁移

    在开始使用迁移(Migrations)之前,我们需要一个 Project 和一个 Code First Model, 对于本文将使用典型的 Blog 和 Post 模型 创建一个新的控制台应用程序 M ...

  6. Struts2配置文件动态传参

    两个Action动态传递参数: 1.从一个Action传递到另一个Action如果带有参数那么result中的type属性需要使用redirect 第一个Action代码如下: private Str ...

  7. 查看,添加和删除GIT配置的正确姿势

    查看GIT所有配置的命令: git config --list 查看GIT全局配置的命令: git config --global --list 添加GIT全局配置(HTTPS代理) git conf ...

  8. c++的输入和输出流

    C++编译系统提供了用于输入输出的iostream类库.iostream这个单词是由3个部 分组成的,即i-o-stream,意为输入输出流.在iostream类库中包含许多用于输入输出的 类.常用的 ...

  9. js 技巧

    用于浮窗跳转至父窗口 parent.document.location.href='/xxx/xxx.htm'; 取父窗口的元素 window.parent.$('#xxx'); 正常跳转 windo ...

  10. 使用日志记录功能查看PHP扩展的执行过程

    了解过PHP内核的同学都知道,PHP的一次请求的生命周期 1.启动Apache后,PHP解释程序也随之启动.PHP调用各个扩展的MINIT方法,从而使这些扩展切换到可用状态 2.当一个页面请求发生时, ...