【链接】 我是链接,点我呀:)

【题意】

在这里输入题意

【题解】

假设现在每个人收到的信息条数存在cnt里面
那个人猜的条数为target
则如果cnt[i]==target[i]
则我们就让第i个人来就好了。
因为s[i][i]=1恒成立。
所以第i个人它的cnt个数肯定递增了。
因此第i个人的cnt值和target值肯定再也不会相同了。
(其他人如果来的话,只会让这个人的cnt值越来越大,离target越来越远

所以如果对每个人都这么做的话。

最后肯定可以让所有人的cnt值都和target值不一样。

【代码】

#include <bits/stdc++.h>
using namespace std; const int N = 100+10; int n,cnt[N],target[N],bo[N+10];
char s[N][N]; int main(){
#ifdef LOCAL_DEFINE
freopen("rush_in.txt", "r", stdin);
#endif
ios::sync_with_stdio(0),cin.tie(0);
cin >> n;
for (int i = 1;i <= n;i++) cin >> (s[i]+1);
for (int i = 1;i <= n;i++) cin >> target[i];
while (1){
int ok = 0;
for (int i = 1;i <= n;i++)
if (cnt[i]==target[i]){
bo[i] = 1;
for (int j = 1;j <= n;j++)
{
int k = s[i][j]-'0';
cnt[j]+=k;
}
ok = 1;
}
if (!ok) break;
}
int num = 0;
for (int i = 1;i <= n;i++) num+=bo[i];
cout<<num<<endl;
for (int i = 1;i <= n;i++)
if (bo[i]){
cout<<i<<' ';
}
return 0;
}

最新文章

  1. [Android Tips] 21. Regex Named Groups in Android
  2. 洛谷P2409 Y的积木
  3. 九个uname命令获取Linux系统详情的实例
  4. C++析构函数定义为虚函数(转载)
  5. Redis 宣言(Redis Manifesto)
  6. Editplus 中将文本换行替换为&lt;p&gt;标签的正则表达式
  7. 【转】怎样创建一个Xcode插件(Part 2)
  8. VBA 开发学习--基础语法
  9. ZOJ 3609 求逆元
  10. 使用Stardict命令行版本sdcv
  11. python高阶函数式编程
  12. Java自定义异常类以及异常拦截器
  13. mongoose一看就会的基本操作
  14. [面试题]vi/vim快捷键及面试题系列
  15. [Asp.net]web.config customErrors 如何设置?
  16. Qt Installer Framework 使用说明(三)
  17. python中web应用与mysql数据库交互
  18. nginx+tomat https ssl 部署 完美解决方案
  19. BigDecimalUtils BigDecimal加减乘除
  20. (N)IO Frameworks in Java

热门文章

  1. 【翻译自mos文章】开启dblink的 oracle net trace/tracing --对dblink进行跟踪的方法
  2. Objective-C对象与Core Foundation对象
  3. 设置Webdriver启动chrome为默认用户的配置信息
  4. sass07 函数
  5. sicily 1004. 简单哈希
  6. Signal programming
  7. WinDBG help
  8. 容器配置https
  9. vue+element-ui的简洁导入导出功能
  10. 网络载入数据和解析JSON格式数据案例之空气质量监測应用