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. 输入参数varargin

    一种特别的输入参数varargin 可以在自定义函数中得到,这种函数支持输入参数的变量的个数.这个参数显在输入参数列表的最后一项,它返回一个单元阵列,所以一个输入实参可以包括任意数目的实参.每一个实参 ...

  2. js父窗口opener与parent

    parent表示父窗口,比如一个A页面利用iframe或frame调用B页面,那么A页面所在窗口就是B页面的parent.在JS 中,window.opener只是对弹出窗口的母窗口的一个引用.比如: ...

  3. 自定义EL函数:小写转大写

    1,定义java静态方法,FunctionDemo,有小写转大写的功能 package com.itheima.domain; public class FunctionDemo { public s ...

  4. 将秒格式化为时分秒的JS函数

    //时间格式化 function GetDateTime(time) { if (time >= 60 && time <= 3600) { time = parseInt ...

  5. Jquery方法大全

    一.JQuery常用的方法 :(JQuery中90%都是方法,没有参数是获取,带参数是设置) $("#id").css('backgroundColor','blue'); .cs ...

  6. C# 批量插入表SQLSERVER SqlBulkCopy往数据库中批量插入数据

    #region 帮助实例:SQL 批量插入数据 多种方法 /// <summary> /// SqlBulkCopy往数据库中批量插入数据 /// </summary> /// ...

  7. WCF编程系列(五)元数据

    WCF编程系列(五)元数据   示例一中我们使用了scvutil命令自动生成了服务的客户端代理类: svcutil http://localhost:8000/?wsdl /o:FirstServic ...

  8. Ubuntu将程序图标加到启动器

    问题: Ubuntu中安装一些程序的时候图标可能没有放到启动器中,不方便使用. 解决问题: 因为FileZilla这个程序是直接解压缩之后便可以使用的,每次都需要到文件所在目录Filezilla/bi ...

  9. (poj)3268 Silver Cow Party 最短路

    Description One cow ≤ N ≤ ) conveniently numbered ..N ≤ X ≤ N). A total of M ( ≤ M ≤ ,) unidirection ...

  10. iOS 简单理解类的本质

    1.类也是个对象 类是一个对象是Class类型的对象简称类对象 Class类型的定义 // 一个任意的类型,表示一个Objective-C类 typedef struct objc_class *Cl ...