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. openstack私有云布署实践【14.1 登录页dashboard-controller(科兴环境)】

    2台kxcontroller安装组件 # yum install openstack-dashboard -y   修改一样的配置 vi /etc/openstack-dashboard/local_ ...

  2. android项目实战 --ListView 头部ViewPager广告轮询图效果

    看开源框架:https://github.com/tianshaojie/AndroidFine,里面有如下效果,特记录学习下,以后项目中用也好能够立刻想起来.   如上面所示,是常见项目中的图片轮训 ...

  3. MySQL设置binlog日志的有效期自动回收

    设置日志保留天数,到期后自动删除 查看当前日志保存天数: show variables like '%expire_logs_days%'; 默认是0,即永不过期. 通过设置全局参数修改: set g ...

  4. HDU 5860 Death Sequence

    用线段树可以算出序列.然后o(1)询问. #pragma comment(linker, "/STACK:1024000000,1024000000") #include<c ...

  5. FZU 2193 So Hard

    #include<cstdio> #include<cstring> #include<cmath> #include<algorithm> using ...

  6. noip2015Day2T1-跳石头

    题目描述 Description 一年一度的“跳石头”比赛又要开始了! 这项比赛将在一条笔直的河道中进行,河道中分布着一些巨大岩石.组委会已经选择好了两块岩石作为比赛起点和终点.在起点和终点之间,有N ...

  7. 02--Java TCP Socket编程

    一.基础知识 1. TCP状态转换知识,可参考: http://www.cnblogs.com/qlee/archive/2011/07/12/2104089.html 2. TCP/IP五层模型   ...

  8. ZooKeeper搭建

    ZooKeeper系列之一:ZooKeeper简介 ZooKeeper 是一个为分布式应用所设计的分布的.开源的协调服务.分布式的应用可以建立在同步.配置管理.分组和命名等服务的更高级别的实现的基础之 ...

  9. 一步一步学EF系列3【升级篇 实体与数据库的映射】

    之前的三张为基础篇,如果不考虑架构问题,做一般的小程序,以足够用了.基本的增删改查也都有了.但是作为学习显然是不够的.通过之前三章的学习,有没有发现这样写有什么问题,有没有觉得繁琐的?可能有人会说,之 ...

  10. C# 验证码生成(MVC和非MVC两种方式)

    /// <summary> /// 生成验证码 /// </summary> /// <param name="length">指定验证码的长度 ...