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

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. zoj 1028 Flip and Shift(数学)

    Flip and Shift Time Limit: 2 Seconds      Memory Limit: 65536 KB This puzzle consists of a random se ...

  2. 性能监控工具Munin

    实际场景 公司产品需要观察Ubuntu主机性能,以衡量客户现场的产品是否能满足高频使用需求 选型 在比较了诸多工具之后,考虑时间成本因素,用了比较简单的Munin 安装步骤 1. apt-get in ...

  3. Spring_Aop_(二)

    切面的优先级 @Order(1)注解 指定切面的优先级,值越小优先级越高 @Order(1) @Aspect @Component public class VlidationAspect { @Be ...

  4. orm1.0

    class Field: def __init__(self,name,column_type,primary_key,defaule): self.name = name self.column_t ...

  5. Linux平时常用命令_查看进程_监控日志等命令

    1.查进程     ps命令查找与进程相关的PID号:    ps a 显示现行终端机下的所有程序,包括其他用户的程序.    ps -A 显示所有程序.    ps c 列出程序时,显示每个程序真正 ...

  6. ORACLE 日常维护命令手册

    1查看数据库版本SELECT * FROM V$VERSION; 2查看数据库语言环境SELECT USERENV('LANGUAGE') FROM DUAL; 3查看ORACLE实例状态SELECT ...

  7. @codechef - KILLER@ Painting Tree

    目录 @description@ @solution@ @accepted code@ @details@ @description@ 给定一个 N 个点的有根树,标号 1 到 N,以 1 为根.定义 ...

  8. SPARK-SQL内置函数之字符串函数

    转载请注明转自:http://www.cnblogs.com/feiyumo/p/8763186.html 1.concat对于字符串进行拼接 concat(str1, str2, ..., strN ...

  9. 智能算法之Matlab实现(1)——遗传算法(1)

    遗传算法的过程在这里先不介绍了,可能在接下来的几篇文章会介绍,这里介绍些实用的. (1)Sheffield遗传算法工具箱的安装 我共享了下修改过文件名和后缀名的原版工具箱,地址为:http://pan ...

  10. Android Binder简介

    Android使用Linux的进程管理机制,以进程为单位分配虚拟地址空间.为了安全考虑,Android的不同进程之间是相互隔离的(进程之间被禁止直接交互).如果进程间需要通信,必须通过Android的 ...