A:

要么是两次要么4次,判断是否在边界;

 #include<cstdio>
using namespace std; int main()
{
int n,m,x;
bool flag=;
scanf("%d%d",&n,&m);
for(int i=; i<n; i++)
for(int j=; j<m; j++)
{
scanf("%d",&x);
if(x==&&(i==||i==n-||j==||j==m-))
flag=;
}
if(flag)puts("");
else puts("");
return ;
}

B:

太简单了;

 #include<cstdio>
using namespace std; int main()
{
int n,k;
scanf("%d%d",&n,&k);
for(int i=;i<=k;i++)
printf("%d %d ",i*,i*-);
for(int i=k+;i<=n;i++)
printf("%d %d ",i*-,i*);
return ;
}

C:

分子每个都是N-1项的,所以从他们的最小的那个开始;

如果有k的整数倍个,就把他们合成一个,然后找到最小的那个不能合成的;

 #include<cstdio>
#include<map>
#include<iostream>
#define maxn 100005
#define ll long long
#define mod 1000000007
using namespace std;
ll d[maxn],sum;
ll num[maxn];
map<ll,ll>mp;
map<ll,ll>::iterator it; ll Pow(ll x,ll k)
{
if(k==)
return ;
if(k==)
return x;
ll c=Pow(x,k>>);
if(k&)
return ((c*(x%mod))%mod)*c%mod;
else
return c*c%mod;
} int main()
{
int n;
ll k,ans;
cin>>n>>k;
for(int i=; i<n; i++)
{
cin>>num[i];
sum+=num[i];
}
for(int i=; i<n; i++)
{
mp[sum-num[i]]++;
}
for(it=mp.begin(); it!=mp.end(); it++)
{
if(it->second)
{
if(it->second%k==)
mp[it->first+]+=it->second/k;
else
{
if(it->first<=sum)
ans=it->first;
else ans=sum;
break;
}
}
}
cout<<Pow(k,ans)<<endl;
return ;
}

Codeforces Round #209 (Div. 2)的更多相关文章

  1. Codeforces Round #209 (Div. 2) B. Permutation

    解题思路: 如果序列a是单调递增的,则序列为1,2,..... 2n,则将给出的式子化简得Σ(a2i - a2i-1) = n 如果序列a是单调递减的,则序列为2n,.........2, 1,则将给 ...

  2. Codeforces Round #209 (Div. 2) A. Table

    #include <iostream> #include <vector> using namespace std; int main(){ int n,m; cin > ...

  3. Codeforces Round #209 (Div. 2)C

    刷了一页的WA  ..终于发现了 哪里错了 快速幂模板里一个变量t居然开得long  ... 虽然代码写的丑了点 但是是对的 那个该死的long 啊.. #include <iostream&g ...

  4. Codeforces Round #209 (Div. 2)A贪心 B思路 C思路+快速幂

    A. Table time limit per test 1 second memory limit per test 256 megabytes input standard input outpu ...

  5. Codeforces Round #209 (Div. 2) D. Pair of Numbers (模拟)

    D. Pair of Numbers time limit per test 2 seconds memory limit per test 256 megabytes input standard ...

  6. Codeforces Round #209 (Div. 2) C - Prime Number

    传送门 题意 给出n个数及x,求 \[\frac{\sum _{i=1}^n x^{a_1+a_2+...+a_{i-1}+a_{i+1}+...a_n}}{\prod_{i=1}^n x^{a_i} ...

  7. Codeforces Round #366 (Div. 2) ABC

    Codeforces Round #366 (Div. 2) A I hate that I love that I hate it水题 #I hate that I love that I hate ...

  8. Codeforces Round #354 (Div. 2) ABCD

    Codeforces Round #354 (Div. 2) Problems     # Name     A Nicholas and Permutation standard input/out ...

  9. Codeforces Round #368 (Div. 2)

    直达–>Codeforces Round #368 (Div. 2) A Brain’s Photos 给你一个NxM的矩阵,一个字母代表一种颜色,如果有”C”,”M”,”Y”三种中任意一种就输 ...

随机推荐

  1. JavaScript高级程序设计(第三版)学习笔记8、9、10章

    第8章,BOM BOM的核心对象是window,具有双重角色,既是js访问浏览器的一个接口,又是ECMAScript规定的Global对象.因此,在全局作用域中声明的函数.变量都会变成window对象 ...

  2. sql 中条件in参数问题

    经常遇到条件为in的模糊查询,sql传参可以在service中直接传递参数,不必使用占位符 select * from ud_order where status in ("+status+ ...

  3. Java Thread interrupt

    现有线程对象threadA,调用threadA.interrupt(),则threadA中interrupted状态会被置成false,很多线程中都是通过isInterrupted()方法来检测线程是 ...

  4. C# ACM poj1003

    这题很有内涵,先用简单方法 public static void acm1003(double a) { ) { return; } ; ) { / b; a = a - c; b++; } Cons ...

  5. SQL SERVER 级联删除

    有三个表: Company Address Contact 在Address和Contact中建立外键,外键id为company的id, 那么就不能任意删除Company.但假如在外键约束中把级联删除 ...

  6. 08_rlCoachKin自主编译,调试

    为了知道参数的意思,以及为了从头建立一个项目,我从使用QTCreator来单独建立项目(当然也可以直接使用源代码中建立好的VS项目). 其实也推荐 VS2010调试 如果是用自带的VS项目,那么我们需 ...

  7. 九度OJ 1512 用两个栈实现队列 【数据结构】

    题目地址:http://ac.jobdu.com/problem.php?pid=1512 题目描述: 用两个栈来实现一个队列,完成队列的Push和Pop操作. 队列中的元素为int类型. 输入: 每 ...

  8. C++实现一个单例模板类

    单例模式在项目开发中使用得比较多,一个单例的模板类显得很有必要,避免每次都要重复定义一个单例类型 //非多线程模式下的一个单例模板类的实现 // template_singleton.h #inclu ...

  9. HTML5 Video与Audio 视频与音频

    ---- 视频Video对象 - 指定视频播放地址 <video width="320" height="240" controls="cont ...

  10. Windows Phone中用到的类名及对应的命名控件及引用

    //INotifyPropertyChanged using System.ComponentModel; //ICommand using System.Windows.Input; //Actio ...