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. 说说我的web前端之路,分享些前端的好书(转)

    WEB前端研发工程师,在国内算是一个朝阳职业,这个领域没有学校的正规教育,大多数人都是靠自己自学成才.本文主要介绍自己从事web开发以来(从大二至今)看过的书籍和自己的成长过程,目的是给想了解Java ...

  2. IPv4(三)地址掩码

    回顾网络类型确定 回顾一下之前学过的如果确定IP地址网络号,这里先不考虑子网. 首先通过首个八位组字节规则很容易确定IP地址属于那个网络: 如果第1位是0,则是A类地址: 如果前两位是10,则是B类地 ...

  3. Microsoft-office 常见问题

    1.工作表写入保护,忘记密码,解决办法: 流程如下: 1打开文件2工具---宏----录制新宏---输入名字如:aa3停止录制(这样得到一个空宏)4工具---宏----宏,选aa,点编辑按钮5删除窗口 ...

  4. linux下的显示有中国农历的日历ccal

    1.linux下的显示有中国农历的日历ccal

  5. erlang中遍历取出某个位置的最大值

    例:有这么一个列表,A = [["abc","bds",3],["ssdss","dddx",2],["sfa ...

  6. C++复习:位运算

    与          a&b :    1010&1100=1000  或          a|b  :  1010|1100=1110 异或       a^b :     101 ...

  7. WCP人员管理之添加人员

    1.用户管理页面 其中 : var url_formActionUser = "user/form.do";//增加.修改.查看URL 2. 通过 /form 路由, 转到 Use ...

  8. Eclipse打jar包的方法

    1.准备主清单文件 “MANIFEST.MF” Manifest-Version: 1.0 Class-Path: lib/commons-codec.jar lib/commons-httpclie ...

  9. 使用ab 进行并发压力测试

    使用ab 进行并发压力测试 - 参与商 - 博客园 https://www.cnblogs.com/shenshangzz/p/8340640.html 使用ab 进行并发压力测试   ab全称为:a ...

  10. 限制线程数 Limit the number of threads started by colly 随机延迟

    random delay | Colly http://go-colly.org/docs/examples/random_delay/