A题

分析:暴力

 #include "iostream"
#include "cstdio"
#include "cstring"
#include "string"
using namespace std;
const int maxn=+;
int vis[maxn],n;
string s;
int main()
{
cin>>s;
cin>>n;
int len=s.length();
for(int i=;i<len;i++){
vis[s[i]-'a']++;
}
if(len<n){
cout<<"impossible"<<endl;
}else{
int num=;
for(int i=;i<;i++){
if(vis[i])
num++;
}
if(num>=n)
cout<<""<<endl;
else
cout<<(n-num)<<endl;
}
return ;
}

B题

分析:求不同set的个数,同一个set的元素必须相同,而且是同一行,同一列的。所以对每行,每列,求有多少个0,多少个1,然后集合个数位(2^k-1),最后所有的单个元素都被算了两次,所以最后结果在减去n*m

 #include "iostream"
#include "cstdio"
#include "cstring"
#include "string"
#include "vector"
#include "cmath"
using namespace std;
const int maxn=+;
int n,m;
int a[maxn][maxn];
struct Node
{
int zero,one;
};
vector<Node>p;
int main()
{
cin>>n>>m;
for(int i=;i<=n;i++)
for(int j=;j<=m;j++)
cin>>a[i][j];
for(int i=;i<=n;i++){
int num0=,num1=;
for(int j=;j<=m;j++){
if(a[i][j]==)
num1++;
else
num0++;
}
Node e;
e.zero=num0,e.one=num1;
p.push_back(e);
}
for(int j=;j<=m;j++){
int num0=,num1=;
for(int i=;i<=n;i++){
if(a[i][j]==)
num1++;
else
num0++;
}
Node r;
r.zero=num0,r.one=num1;
p.push_back(r);
}
long long res=;
for(int i=;i<p.size();i++){
res+=(long long)pow(,p[i].zero)-(long long);
res+=(long long)pow(,p[i].one)-(long long);
}
res-=(n*m);
cout<<res<<endl;
return ;
}

AIM Tech Round 4 (Div. 2)的更多相关文章

  1. codeforce AIM tech Round 4 div 2 B rectangles

    2017-08-25 15:32:14 writer:pprp 题目: B. Rectangles time limit per test 1 second memory limit per test ...

  2. AIM Tech Round 3 (Div. 2)

    #include <iostream> using namespace std; ]; int main() { int n, b, d; cin >> n >> ...

  3. AIM Tech Round 3 (Div. 2) A B C D

    虽然打的时候是深夜但是状态比较好 但还是犯了好多错误..加分场愣是打成了降分场 ABC都比较水 一会敲完去看D 很快的就想出了求0和1个数的办法 然后一直wa在第四组..快结束的时候B因为低级错误被h ...

  4. AIM Tech Round 3 (Div. 2) B

    Description Vasya takes part in the orienteering competition. There are n checkpoints located along ...

  5. AIM Tech Round 3 (Div. 2) A

    Description Kolya is going to make fresh orange juice. He has n oranges of sizes a1, a2, ..., an. Ko ...

  6. AIM Tech Round 3 (Div. 2) (B C D E) (codeforces 709B 709C 709D 709E)

    rating又掉下去了.好不容易蓝了.... A..没读懂题,wa了好几次,明天问队友补上... B. Checkpoints 题意:一条直线上n个点x1,x2...xn,现在在位置a,求要经过任意n ...

  7. AIM Tech Round 3 (Div. 2) B 数学+贪心

    http://codeforces.com/contest/709 题目大意:给一个一维的坐标轴,上面有n个点,我们刚开始在位置a,问,从a点开始走,走n-1个点所需要的最小路程. 思路:我们知道,如 ...

  8. AIM Tech Round 3 (Div. 2)D. Recover the String(贪心+字符串)

    D. Recover the String time limit per test 1 second memory limit per test 256 megabytes input standar ...

  9. AIM Tech Round 4 (Div. 2)ABCD

    A. Diversity time limit per test 1 second memory limit per test 256 megabytes input standard input o ...

  10. AIM Tech Round 4 (Div. 2)(A,暴力,B,组合数,C,STL+排序)

    A. Diversity time limit per test:1 second memory limit per test:256 megabytes input:standard input o ...

随机推荐

  1. Visual Studio 连接 SQL Server 的connectionStringz和

    近期C#和数据结构的课程设计多次用到了C#中连接SQL Server数据库的问题,当中涉及到数据库文件的附加和连接问题. 当中最烦人的就是  SqlConnection(String connStr) ...

  2. C与C++在形參的一点小差别

    先看一下以下的代码: int fun(a,b) int a; int b; { return 10; } void main(int argc, char ** argv) { fun(10); re ...

  3. 深入浅出Attribute(二)

    上篇里,我们把Attribute“粘”在类的成员方法上show了一把,让Attribute跟大家混了个脸儿熟.中篇里,我们将探讨“究竟什么是Attribute”和“如何创建及使用Attribute”这 ...

  4. 重新编译Nginx指导手册【修复静态编译Openssl的Nginx漏洞 】(转)

    1. 概述    当前爆出了Openssl漏洞,会泄露隐私信息,涉及的机器较多,环境迥异,导致修复方案都有所不同.不少服务器使用的Nginx,是静态编译opensssl,直接将openssl编译到ng ...

  5. 进程间通信(IPC)+进程加锁解锁

    [0]README 0.1) source code and text description are from orange's implemention of a os: 0.2) for com ...

  6. 跳过权限检查,强制修改mysql密码

    windows: 1,停止MYSQL服务,CMD打开DOS窗口,输入 net stop mysql 2,在CMD命令行窗口,进入MYSQL安装目录 比如E:\Program Files\MySQL\M ...

  7. JS 之 数据类型转换

          首先我们来简单了解一下JS中的数据类型,JavaScript拥有字符串.数字.布尔.数组.对象.Null.Undefiend 6中数据类型.同一时候,JavaScript拥有动态类型. 也 ...

  8. ifndef/define/endif 和 #ifdef 、#if 作用和用法

    为了能简单的看看某些linux内核源码,复习了一下c语音,今天汇总了一下关于宏定义的相关内容: 一.ifndef/define/endif用法: .h文件,如下: #ifndef XX_H #defi ...

  9. Python中高层次的数据结构,动态类型和动态绑定,使得它非常适合于快速应用开发,也适合于作为胶水语言连接已有的软件部件。

    https://github.com/jhao104/proxy_pool/blob/master/doc/introduce.md 3.代码模块 Python中高层次的数据结构,动态类型和动态绑定, ...

  10. 20179209《Linux内核原理与分析》第一周作业

    如何揭开Linux操作系统的最大面纱 个人认为,真正理解一个操作系统最根本的就是理解其文件系统结构. 自windows图形界面诞生,国内大多数用户都选择了windows操作系统,很多人觉得window ...