E - The King
Description
Input
Output
Sample Input
3
3
2 -1 1
Sample Output
9
Hint
#include <iostream>
#include <cmath>
using namespace std;
int main()
{
int n,b,a,s=;
cin>>n;
cin>>a;
for(int i=;i<n;i++){
cin>>b;
if(b>||(b<&&a%==))s+=pow((double)b,a);
}
cout<<s;
//system("pause");
return ;
}
E - The King的更多相关文章
- BZOJ 1087: [SCOI2005]互不侵犯King [状压DP]
1087: [SCOI2005]互不侵犯King Time Limit: 10 Sec Memory Limit: 162 MBSubmit: 3336 Solved: 1936[Submit][ ...
- [bzoj1087][scoi2005]互不侵犯king
题目大意 在N×N的棋盘里面放K个国王,使他们互不攻击,共有多少种摆放方案.国王能攻击到它上下左右,以及左上 左下右上右下八个方向上附近的各一个格子,共8个格子. 思路 首先,搜索可以放弃,因为这是一 ...
- King's Quest —— POJ1904(ZOJ2470)Tarjan缩点
King's Quest Time Limit: 15000MS Memory Limit: 65536K Case Time Limit: 2000MS Description Once upon ...
- 【状压DP】bzoj1087 互不侵犯king
一.题目 Description 在N×N的棋盘里面放K个国王,使他们互不攻击,共有多少种摆放方案.国王能攻击到它上.下.左.右,以及左上.左下.右上.右下八个方向上附近的各一个格子,共8个格子. I ...
- ZOJ 2334 Monkey King
并查集+左偏树.....合并的时候用左偏树,合并结束后吧父结点全部定成树的根节点,保证任意两个猴子都可以通过Find找到最厉害的猴子 Monkey King ...
- ACM ICPC 2015 Moscow Subregional Russia, Moscow, Dolgoprudny, October, 18, 2015 K. King’s Rout
K. King's Rout time limit per test 4 seconds memory limit per test 512 megabytes input standard inpu ...
- BZOJ-1087 互不侵犯King 状压DP+DFS预处理
1087: [SCOI2005]互不侵犯King Time Limit: 10 Sec Memory Limit: 162 MB Submit: 2337 Solved: 1366 [Submit][ ...
- POJ1364 King
Description Once, in one kingdom, there was a queen and that queen was expecting a baby. The queen p ...
- [Educational Codeforces Round 16]A. King Moves
[Educational Codeforces Round 16]A. King Moves 试题描述 The only king stands on the standard chess board ...
- codeforces A. Rook, Bishop and King 解题报告
题目链接:http://codeforces.com/problemset/problem/370/A 题目意思:根据rook(每次可以移动垂直或水平的任意步数(>=1)),bishop(每次可 ...
随机推荐
- MyEclipse安装xfire插件
xfire因为过时,MyEclipse已经将其支,如果想用只能手动添加了. 安装步骤: 1.点击help┈┈┈→install from site出现下图 在第一栏里,输出http://dist.co ...
- uva 508 Morse Mismatches
Samuel F. B. Morse is best known for the coding scheme that carries his name. Morse code is still us ...
- (转) Special members
原地址:http://www.cplusplus.com/doc/tutorial/classes2/ Special members [NOTE: This chapter requires p ...
- (转) 学习C++ -> 向量(vector)
vector是向量类型,它是一种对象实体,具有值,所以可以看作是变量. 它可以容纳许多其他类型的相同实体,如若干个整数,所以称其为容器. vector类与一般的Array类的区别在于: 1 ...
- UVA 10253 Series-Parallel Networks (树形dp)
转载请注明出处: http://www.cnblogs.com/fraud/ ——by fraud Series-Parallel Networks Input: standard ...
- (原)使用mkl计算特征值和特征向量
转载请注明出处: http://www.cnblogs.com/darkknightzh/p/5585271.html 参考文档:mkl官方文档 lapack_int LAPACKE_sgeev(in ...
- css架构目标:预测,重用,扩展,维护
请参看下面链接: CSS架构目标:预测.重用.扩展.维护
- android ant 最简单的打包签名,混淆方法
使用ant打包,如果脚本都是我们自己一步一步来写的话,是一个比较麻烦的东西. 关于ant,我们详细看下: ant支持 ant debug,ant release等命令,我们需要签名混淆,那么就需要an ...
- Ubuntu 安装 pecl_http
由于开发环境需要用到pecl_http,根据网上找的教程一直没用按照成功,查看错误,pcre这里出错了,原来要安装这个libpcre3-dev,安装好这个就成功了,记下命令. $ sudo apt-g ...
- 检测.net framework 版本
项目中,自己要制作asp.net项目的安装文件,由于项目依赖于.net framework 3.5 sp1,故需检测环境是否符合要求,才能安装程序 度娘找到检测方案:各.net版本对应的安装补录下都有 ...