现在水平真的不够、只能够做做水题

A. Slime Combining

题意:就是给n个1给你、两个相同的数可以合并成一个数,比如说有两个相同的v,合并后的值就是v+1

思路:直接模拟栈

 #include<iostream>
#include<algorithm>
#include<stack>
using namespace std;
int num[];
int main()
{
int n;
while(cin >> n){
stack<int>p;
p.push();
for(int i=;i<n;++i){
p.push();
int x,y;
while(p.size()>=){
x=p.top();p.pop();
y=p.top();p.pop();
if(x==y)
p.push(x+);
else{
p.push(y);p.push(x);
break;
}
}
}
int k=;
while(!p.empty()){
num[k++]=p.top();
p.pop();
}
for(int i=k-;i>=;--i)
if(i==k-) cout << num[i];
else cout << " " << num[i];
cout << endl;
}
}

B. Guess the Permutation

这题还想了好久、其实想通了就很简单了

题意:给你一个正方形的数值阵,每一个数值阵中的值map[i][j]=min(a[i],a[j]),也就是值是两者中较小的一个,数组a是一个序列,让你通过这个数值阵去还原数组a

思路:每一行中如果不同的元素个数等于n个,那么这个序列除了0以为其他的数值就是数组a中的序列数,剩下的只要把0改成n就可以了

   还一种思路(被人家教育了)就是每一行中的最大值其实就是数组a[i]的值、但需要注意n-1的n,(思考)

  

 #include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<set>
using namespace std;
const int qq=;
int map[qq][qq];
int main()
{
set<int>p[qq];
int n;scanf("%d",&n);
for(int j,i=;i<=n;++i){
for(j=;j<=n;++j){
scanf("%d",&map[i][j]);
p[i].insert(map[i][j]);
}
}
int ans;
for(int i=;i<=n;++i)
if(p[i].size()==n){
ans=i;break;
}
for(int i=;i<=n;++i){
if(i==)
if(map[ans][i]!=) printf("%d",map[ans][i]);
else printf("%d",n);
else
if(map[ans][i]!=) printf(" %d",map[ans][i]);
else printf(" %d",n);
}
printf("\n");
}
#include<iostream>
using namespace std;
int main()
{
int n,f=;
cin>>n;
for(int i=;i<n;i++){
int m=;
for(int j=;j<n;j++)
{
int x;
cin>>x;
m=max(m,x);
}
if(m==n- && f)
{
f=;
m+=;
}
cout<<m<<" ";
} return ;
}

说白了B题就是找规律、- - 以后不能这么傻了

    

Wunder Fund Round 2016 (Div. 1 + Div. 2 combined)的更多相关文章

  1. Wunder Fund Round 2016 (Div. 1 + Div. 2 combined) B. Guess the Permutation 水题

    B. Guess the Permutation 题目连接: http://www.codeforces.com/contest/618/problem/B Description Bob has a ...

  2. Wunder Fund Round 2016 (Div. 1 + Div. 2 combined) A. Slime Combining 水题

    A. Slime Combining 题目连接: http://www.lydsy.com/JudgeOnline/problem.php?id=2768 Description Your frien ...

  3. Wunder Fund Round 2016 (Div. 1 + Div. 2 combined) F. Double Knapsack 鸽巢原理 构造

    F. Double Knapsack 题目连接: http://www.codeforces.com/contest/618/problem/F Description You are given t ...

  4. Wunder Fund Round 2016 (Div. 1 + Div. 2 combined) E. Robot Arm 线段树

    E. Robot Arm 题目连接: http://www.codeforces.com/contest/618/problem/E Description Roger is a robot. He ...

  5. CF Intel Code Challenge Final Round (Div. 1 + Div. 2, Combined)

    1. Intel Code Challenge Final Round (Div. 1 + Div. 2, Combined) B. Batch Sort    暴力枚举,水 1.题意:n*m的数组, ...

  6. Educational Codeforces Round 60 (Rated for Div. 2) - C. Magic Ship

    Problem   Educational Codeforces Round 60 (Rated for Div. 2) - C. Magic Ship Time Limit: 2000 mSec P ...

  7. Educational Codeforces Round 60 (Rated for Div. 2) - D. Magic Gems(动态规划+矩阵快速幂)

    Problem   Educational Codeforces Round 60 (Rated for Div. 2) - D. Magic Gems Time Limit: 3000 mSec P ...

  8. Educational Codeforces Round 43 (Rated for Div. 2)

    Educational Codeforces Round 43 (Rated for Div. 2) https://codeforces.com/contest/976 A #include< ...

  9. Educational Codeforces Round 35 (Rated for Div. 2)

    Educational Codeforces Round 35 (Rated for Div. 2) https://codeforces.com/contest/911 A 模拟 #include& ...

随机推荐

  1. python中的True和False

    返回真假时,需要为: return True return False

  2. I / O流 类

    一.概述 1 基本概念 I/O就是Input/Output的简写,也就是输入/输出的含义. I/O流就是指像流水一样源源不断地进行读写的过程.   2 基本分类   根据读写数据的单元分为:字节流 和 ...

  3. Day2-转自金角大王

    本节内容 列表.元组操作 字符串操作 字典操作 集合操作 文件操作 字符编码与转码 1. 列表.元组操作 列表是我们最以后最常用的数据类型之一,通过列表可以对数据实现最方便的存储.修改等操作 定义列表 ...

  4. 跟我一起学extjs5(02--建立project项目)

    版权声明:本文为博主原创文章,未经博主同意不得转载. https://blog.csdn.net/jfok/article/details/35569057 跟我一起学extjs5(02--建立pro ...

  5. SQLSERVER 时间函数汇总

    1.求当天的年份 (getdate(): 2012/05/08 18:07:26) SELECT YEAR(GETDATE())     --2012 2. 求当天的月份       SELECT M ...

  6. VS2013下设置git同步,“出现了错误。详细消息: An error was raised by libgit2. Category = Net (Error).”。

    前言: 这个错误耽误了我数个小时,终于解决,不知道为何VS官方在与github同步上面做得如此麻烦.希望能帮到大家. 出现了错误.详细消息: An error was raised by libgit ...

  7. bnd.bnd属性文件格式

    1.Header以大写字母开头 Bundle-Name: StoreAdminProductsTool 2.Instruction以-和小写字母开头 -sources: true 3. Macro形式 ...

  8. 盘点Apache毕业的11个顶级项目

    自1999年成立至今,Apache 软件基金会已成功建立起自己强大的生态圈.其社区涌现了非常多优秀的开源项目,同时有越来越多国内外项目走向这个国际开源社区进行孵化.据悉,目前所有的 Apache 项目 ...

  9. app被Rejected 的各种原因翻译。这个绝对有用

    1. Terms and conditions(法律与条款) 1.1  As a developer of applications for the App Store you are bound b ...

  10. Selenium-Switch与SelectApi接口

    Switch 我们在UI自动化测试时,总会出现新建一个tab页面.弹出一个浏览器级别的弹框或者是出现一个iframe标签,这时我们用WebDriver提供的Api接口就无法处理这些情况了.需要用到Se ...