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. 关于Ajax的实现

    AJAX:Asynchronous Javascript And XML.异步的JavaScript和XML. 同步请求: 异步请求: 1.1.1    XMLHttpRequest对象的介绍: 方法 ...

  2. 关于struts2的上传和下载

    1. 1文件上传技术: JSPSmartUpload:应用在Model1年代.(嵌入到JSP) FileUpload:应用在Model2年代. Servlet3.o:完成文件上传. Struts2框架 ...

  3. 【转】PL/SQL编辑数据"这些查询结果不可更新,请包括ROWID或使用SELECT...FOR UPDATE获得可更新结果"处理

    [转]PL/SQL编辑数据"这些查询结果不可更新,请包括ROWID或使用SELECT...FOR UPDATE获得可更新结果"处理 只要有人用了: select t.* from ...

  4. Spark技术内幕:Stage划分及提交源码分析

    http://blog.csdn.net/anzhsoft/article/details/39859463 当触发一个RDD的action后,以count为例,调用关系如下: org.apache. ...

  5. 工作流引擎Activiti使用总结

    http://www.kafeitu.me/activiti/2012/03/22/workflow-activiti-action.html 1.简单介工作流引擎与Activiti 对于工作流引擎的 ...

  6. c# xml 解析取值

    //字符串 string result = "<?xml version=\"1.0\" encoding=\"utf-8\"?>< ...

  7. ASP实现清除HTML标签,清除&nbsp;空格等编码

    '清除HTML格式 Function RemoveHTML(strText) Dim RegEx Set RegEx = New RegExp RegEx.Global = True '清除HTML标 ...

  8. 转:Unity3D的四种坐标系

    World Space(世界坐标):我们在场景中添加物体(如:Cube),他们都是以世界坐标显示在场景中的.transform.position可以获得该位置坐标. Screen Space(屏幕坐标 ...

  9. Java_链表实现

    http://blog.csdn.net/a19881029/article/details/22695289

  10. C 中随机数

    C语言,如何产生随机数: 基本函数 在C中取随机数所需要对函数是: int rand ( void ); void srand ( unsigned int n); 备注:必须包含该头文件#inclu ...