题目链接

分析:这题都过了2000了,应该很简单。。写这篇只是为了凑篇数= =

假设在第i级的时候开方过后的数为i∗t[i],t[i]是第i级的系数。那么

(3t[3])2−(2t[2])≡0(mod2)

(4t[4])2−(3t[3])≡0(mod3)

(5t[5])2−(4t[4])≡0(mod4)



(3t[3])2≡0(mod2)

(4t[4])2≡0(mod3)

(5t[5])2≡0(mod4)

显然,最小的情况应该就是t[i]=i−1, 化简一下公式,在i的情况下应该是i∗i∗(i−1)−(i−2),注意i=2时特殊情况,应该为2。

/*****************************************************/
//#pragma comment(linker, "/STACK:1024000000,1024000000")
#include <map>
#include <set>
#include <ctime>
#include <stack>
#include <queue>
#include <cmath>
#include <string>
#include <vector>
#include <cstdio>
#include <cctype>
#include <cstring>
#include <sstream>
#include <cstdlib>
#include <iostream>
#include <algorithm>
using namespace std;
#define offcin ios::sync_with_stdio(false)
#define sigma_size 26
#define lson l,m,v<<1
#define rson m+1,r,v<<1|1
#define slch v<<1
#define srch v<<1|1
#define sgetmid int m = (l+r)>>1
#define LL long long
#define ull unsigned long long
#define mem(x,v) memset(x,v,sizeof(x))
#define lowbit(x) (x&-x)
#define bits(a) __builtin_popcount(a)
#define mk make_pair
#define pb push_back
#define fi first
#define se second const int INF = 0x3f3f3f3f;
const LL INFF = 1e18;
const double pi = acos(-1.0);
const double inf = 1e18;
const double eps = 1e-9;
const LL mod = 1e9+7;
const int maxmat = 10;
const ull BASE = 31; /*****************************************************/ int main(int argc, char const *argv[]) {
int N;
cin>>N;
for (int i = 2; i <= N + 1; i ++) {
if (i == 2) puts("2");
else printf("%I64d\n", 1LL * i * i * (i -1) - 1LL * (i - 2));
}
return 0;
}

Codeforces Round #372 (Div. 2) C. Plus and Square Root的更多相关文章

  1. 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 ...

  2. Codeforces Round #372 (Div. 2)

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

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

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

  4. 构造水题 Codeforces Round #206 (Div. 2) A. Vasya and Digital Root

    题目传送门 /* 构造水题:对于0的多个位数的NO,对于位数太大的在后面补0,在9×k的范围内的平均的原则 */ #include <cstdio> #include <algori ...

  5. 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 ...

  6. 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 ...

  7. 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 ...

  8. 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 ...

  9. Codeforces Round #372 (Div. 2) C 数学

    http://codeforces.com/contest/716/problem/C 题目大意:感觉这道题还是好懂得吧. 思路:不断的通过列式子的出来了.首先我们定义level=i, uplevel ...

随机推荐

  1. sql命令

    oracle 查询所有表中以TICKET开头,TYPE结尾的表,同时不显示末尾为数字的时间表 SELECT * FROM user_col_comments WHERE COLUMN_NAME lik ...

  2. mongoose操作汇总。嘻嘻

    MongoDb 命令查询所有数据库列表  CODE:  > show dbs 如果想查看当前连接在哪个数据库下面,可以直接输入db CODE:  > db  Admin 想切换到test数 ...

  3. JavaScript打印正倒直线

    做了一个作业,用JavaScript打印正倒直线,突然觉得自己还是逻辑有待加强训练啊 document.write("<h3>打印倒正金字塔直线</h3>" ...

  4. easyui from 缓存问题处理

    1 这是ie低版本,缓存了easyui form load事件获取的服务器端数据,给ajax时间加上清除缓存就ok. 找到easyui 中的form load事件  添加cache:false, /* ...

  5. MySQL INSERT插入条件判断:如果不存在则插入

    摘要: 我们经常需要进行sql的批量插入,要求:该条记录不存在则插入,存在则不插入.如果使用一条INSERT语句实现呢? 普通的 INSERT INTO 插入: INSERT INTO card(ca ...

  6. iOS中事件传递过程

    iOS中,UIApplication管理着一个事件的队列,当系统获取用户的点击或滑动等事件后,就会将这些事件按顺序插入UIApplication管理的这个队里中,UIApplication再从这个队列 ...

  7. RPM安装MySQL

    # wget http://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.15-1.el6.x86_64.rpm-bundle.tar # tar x ...

  8. linux 无交互添加用户设置密码

    #!/bin/bash useradd -m test echo " | passwd --stdin test

  9. 安卓CPU性能测试

      步骤1.adb shell (进入linux的底层) 步骤2.echo 3>/proc/sys/vm/drop_caches(清除系统cache) 步骤3.top -d 1|grep com ...

  10. 读文章《Flexbox详解》笔记

    文章地址:Flexbox详解 属性摘抄: flex container : display: other values | flex | inline-flex; flex-direction: ro ...