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. php的一个小坑,输出不了json_encode

    明明是旧代码,怎么换个地方就不执行了.一开始怀疑是Php的版本. 最后才知道是我的编辑器nodepad++给坑了.或许不是nodepad++的坑.总之,需要转化为utf-8格式编码即可

  2. 常见的CPU訪问引起的内存保护问题为什么仅仅用event_122上报 - 举例2

    还有一个样例.通过以下的log看,CPU在訪问reserved的地址0x53611EFD.非法訪问时该地址会在L1D内存控制器的L1DMPFSR寄存器中记录. ** FATAL EXCEPTION N ...

  3. 苹果开发之COCOA编程(第三版)上半部分

    第一章:什么是Cocoa 1.1 历史简介 1.2 开发工具:Xcode.Interface Builder(一个GUI构建工具).在它们内部,使用gcc为编译器来编译代码,并使用gdb来查找错误 1 ...

  4. 【BZOJ3489】A simple rmq problem kd-tree

    [BZOJ3489]A simple rmq problem Description 因为是OJ上的题,就简单点好了.给出一个长度为n的序列,给出M个询问:在[l,r]之间找到一个在这个区间里只出现过 ...

  5. SQL Server 中 GO 的用法(转)

    本科里学了那么多年SQL Server一直看到书上各种SQL语句中间夹杂着那么几个看似毫无意义的GO,看着就让人莫名,问老师,老师一般只会告诉你,不要理他,这个东西没用的.但是个性纠结并且有轻微强迫症 ...

  6. iOS 流布局 UICollectionView使用(使用FlowLayout进行更灵活布局)

    在UICollectionView的布局中,如果每个item的大小都一样那么是十分简单的事情,但是,如果我们想要的每个item大小不一样呢,这个时候,就要对UICollectionViewFlowLa ...

  7. 使用Fiddler测试HTTP接口

    Fiddler下载地址:https://www.telerik.com/download/fiddler/fiddler4 在测试http接口前,为避免干扰,我们启用过滤器 然后运行过滤器设置 我们以 ...

  8. js实现随机选取[10,100)中的10个整数,存入一个数组,并排序。 另考虑(10,100]和[10,100]两种情况。

    1.js实现随机选取[10,100)中的10个整数,存入一个数组,并排序. <!DOCTYPE html> <html lang="en"> <hea ...

  9. 洛谷 2261 [CQOI2007]余数求和

    题目戳这里 一句话题意 求 \(\sum_{i=1}^{n} (k ~~\texttt{mod} ~~i)\) Solution 30分做法: 说实话并不知道怎么办. 60分做法: 很明显直接一遍o( ...

  10. (转)nginx-rtmp-module和ffmpeg搭建实时HLS切片

    1.rtmp服务器 nginx+pcre+zlib+openssl+nginx-rtmp-module ./configure \ --prefix=/usr/local/nginx \ --sbin ...