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

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. WPF数据绑定详解

    元素绑定 数据绑定最简单的形式是,源对象是WPF元素而且源属性是依赖属性.依赖项属性具有内置的更改通知支持,当在源对象中改变依赖项属性的值时,会立即更新目标对相中的绑定属性. <!--Xaml程 ...

  2. JavaScript异步

    JavaScript异步类型 延迟类型:setTimeout.setInterval.setImmediate 监听事件:监听new Image加载状态.监听script加载状态.监听iframe加载 ...

  3. (转载)怎样解决SQL Server内存不断增加问题

    在启用sqlserver服务后,发现进程sqlservr.exe的内存使用量从开始的100多MB持续增加,很快就高达1G以上,造成机器运行缓慢.卡机,严重影响使用.sql server 在查询大数据量 ...

  4. get请求url中带有中文参数出现乱码情况

    在项目中经常会遇到中文传参数,在后台接收到乱码问题.那么在遇到这种情况下我们应该怎么进行处理让我们传到后台接收到的参数不是乱码是我们想要接收的到的,下面就是我的一些认识和理解. get请求url中带有 ...

  5. python 利用csv模块导入数据

  6. SDUT-3375_数据结构实验之查找三:树的种类统计

    数据结构实验之查找三:树的种类统计 Time Limit: 400 ms Memory Limit: 65536 KiB Problem Description 随着卫星成像技术的应用,自然资源研究机 ...

  7. Mysql数据库日志类型查询与配置详解

    在mysql中日志分为很多种,下面小编来给大家介绍Mysql数据库日志类型查询与使用,希望对各位同学会有所帮助 mysql常见的日志类型有五种:错误日志.二进制日志.查询日志.慢查日志和中继日志. 一 ...

  8. node.js(连接mysql)

    mysql语句中的SQL sql语句中的分类: ---DDL:(data define language)定义数据列(create,drop,alter,truncate) ---DML:(data ...

  9. 通过反射 修改访问和修改属性的值 Day25

    package com.sxt.field; /* * 通过反射拿到属性值 * 修改public属性值 * 修改private属性值 * 缺点:可读性差:代码复杂 * 优点:灵活:可以访问修改priv ...

  10. 卸载ROS命令

    ROS有问题需要卸载只需输入以下命令: sudo apt-get purge ros-* sudo rm -rf /etc/ros