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

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操作SQLite数据库的方法详解

    Python操作SQLite数据库的方法详解 本文实例讲述了Python操作SQLite数据库的方法.分享给大家供大家参考,具体如下: SQLite简单介绍 SQLite数据库是一款非常小巧的嵌入式开 ...

  2. vuehomework1

    红黄蓝三个按钮,点击不同的按钮可以切换一个200*200的矩形框对应的颜色 <!DOCTYPE html> <html lang="en"> <hea ...

  3. 项目管理知识图谱OR架构图

    做项目管理,心中一定要有知识图谱,科学的知识储备+100%执行力=好的管理者. 德鲁克所言:  领导是“做正确的事”,管理是“把事做正确”.

  4. windows10 中微信(UWP)版本不显示通知消息

    前言: 前段时间笔者更换了升级了WINDOWS10系统,从应用商店安装微信后,使用期间不会推送消息通知,右下角的通知栏也无法添加微信图标.搜索百度和Google后,发现很多人都是这样,这是微信(UWP ...

  5. Codeforces 13C

    这题纠结了近半年,一直没有好的思路. 刚开始看这题的时候就是暴力,明显的TLE 后来才知道这题的“一种解”肯定是"原数列中某些数的集合" (很明显这题的最优策略并不唯一) 有原数列 ...

  6. Leetcode830.Positions of Large Groups较大分组的位置

    在一个由小写字母构成的字符串 S 中,包含由一些连续的相同字符所构成的分组. 例如,在字符串 S = "abbxxxxzyy" 中,就含有 "a", " ...

  7. oracle loader

    控制文件的格式    load data    infile '数据文件名'    into table 表名    (first_name position(01:14) char,     sur ...

  8. 【Linux】 经典Linux系统工程师面试题(转载)

    1.如何将本地80端口的请求转发到8080端口,当前主机IP为192.168.16.1,其中本地网卡eth0: 答: # iptables -t nat -A PREROUTING -d 192.16 ...

  9. python 数据集变量的数据类型总结

  10. Redis源码解析:08对象

    前面介绍了Redis用到的所有主要数据结构,比如简单动态字符串(SDS).双端链表.字典.压缩列表.整数集合等.然而Redis并没有直接使用这些数据结构来实现键值对数据库,而是基于这些数据结构创建了一 ...