玲珑学院 1010 - Alarm
Time Limit:1s Memory Limit:128MByte
Given a number sequence [3,7,22,45,116,...]
. Please tell me the k
-th number.
indicates the number of the input cases. Then for each case there only is one integer k (1≤k≤10000)
#include <iostream>
#include <cstdio>
#include <cstring>
#include <queue>
#include <cmath>
#include <vector>
#include <algorithm>
using namespace std;
#define lowbit(x) (x&(-x))
#define max(x,y) (x>y?x:y)
#define min(x,y) (x<y?x:y)
#define mem(a) (memset(a,0,sizeof(a)))
typedef long long ll;
ll a[];
ll vis[];
void getprime()
{
memset(a,,sizeof(a));
a[]=;
for(ll i=;i<;i++)
{
if(a[i]==) continue;
for(ll j=;j*i<;j++)
a[j*i]=;
}
ll ans=;
for(ll i=;i<;i++)
{
if(!a[i]) vis[ans++]=i;
if(ans>=) break;
}
}
int main()
{
ll t,n;
scanf("%lld",&t);
getprime();
while(t--)
{
scanf("%lld",&n);
printf("%lld\n", vis[n]*vis[n]-n);
}
}
玲珑学院 1010 - Alarm的更多相关文章
- 玲珑学院-ACM比赛1014 - Absolute Defeat
		
1014 - Absolute Defeat Time Limit:2s Memory Limit:64MByte Submissions:257Solved:73 DESCRIPTION Eric ...
 - 玲珑学院oj 1152 概率dp
		
1152 - Expected value of the expression Time Limit:2s Memory Limit:128MByte Submissions:128Solved:63 ...
 - 玲珑学院1072 【DFS】
		
蛤蛤,略蠢. priority_queue 自定义优先级 和排序是反的 struct node { int x,y; friend bool operator< (node a,node b) ...
 - 玲珑学院OJ 1023 - Magic boy Bi Luo with his excited math problem 树状数组暴力
		
分析:a^b+2(a&b)=a+b so->a^(-b)+2(a&(-b))=a-b 然后树状数组分类讨论即可 链接:http://www.ifrog.cc/acm/probl ...
 - 玲珑学院OJ  1028 - Bob and Alice are playing numbers 字典树,dp
		
http://www.ifrog.cc/acm/problem/1028 题解处:http://www.ifrog.cc/acm/solution/4 #include <cstdio> ...
 - 玲珑学院 1050 - array
		
1050 - array Time Limit:3s Memory Limit:64MByte Submissions:494Solved:155 DESCRIPTION 2 array is an ...
 - 玲珑学院 1052 - See car
		
1052 - See car Time Limit:2s Memory Limit:64MByte Submissions:594Solved:227 DESCRIPTION You are the ...
 - 玲珑学院 1014 Absolute Defeat
		
SAMPLE INPUT 3 2 2 2 1 1 5 1 4 1 2 3 4 5 4 10 3 1 2 3 4 SAMPLE OUTPUT 1 0 15 前缀和,每个元素都判断一下. #include ...
 - 第八届郑州轻工业学院ACM(程序设计大赛)校内预选赛
		
郑州轻工业学院有一个大赛,把几个有趣的题目分享一下.下面是题目连接,喜欢了就点点... 斗破苍穹 礼上往来 统计人数 神の数 炉石传说 Mathematics and Geometry 马拉松后记 斗 ...
 
随机推荐
- Mybaties下的分页功能的实现
			
jsp页面 <!-- 页码 --> <div class="ipRListNav2"> <a href="zyxx.do?findZyxx& ...
 - Leetcode-Best Time to Buy and Sell Stock -java
			
题目: Say you have an array for which the ith element is the price of a given stock on day i. If you w ...
 - 2015年开源项目荣登GitHub十强榜单
			
翻译出自:51CTO.com 开源是一个好东西,2015最振奋人心的就是swift开源. <软件开发时代>杂志(SD Times)回想了GitHub上的一些流行项目,这些项目已给开放和自由 ...
 - HDU   5310  Souvenir
			
Souvenir Accepts: 901 Submissions: 2743 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 262 ...
 - Android ListView动画实现方法
			
在Android中listview是最经常使用的控件之中的一个,可是有时候我们会认为千篇一律的listview看起来过于单调,于是就产生了listView动画,listview载入了动画会让用户体验更 ...
 - opecv2 MeanShift 使用均值漂移算法查找物体
			
#if !defined OFINDER #define OFINDER #include <opencv2\core\core.hpp> #include <opencv2\img ...
 - 关于MAVEN找不到JDK的那点事
			
自从SUN被Oracle收购以后.JDK就由Oracle来提供了. 在新版本号之中,假设你下载安装JDK以后,又选择了JRE安装(当然,如今JRE直接叫做Java了),那么,恭喜你,在 C:\wind ...
 - Android 进程常驻(0)----MarsDaemon使用说明
			
版权声明:本文为博主原创文章,未经博主允许不得转载. 这是一个轻量级的库,配置几行代码,就可以实现在Android上实现进程常驻,也就是在系统强杀下,以及360获取root权限下,clean mast ...
 - Insert Data with C# Driver
			
https://docs.mongodb.com/getting-started/csharp/insert/ OverView You can use the InsertOneAsync meth ...
 - zzulioj--1831-- 周末出游(vector建图+dfs)
			
1831: 周末出游 Time Limit: 1 Sec Memory Limit: 128 MB Submit: 22 Solved: 8 SubmitStatusWeb Board Descr ...