Summer training #11
A:水
#include <bits/stdc++.h>
#include <cstring>
#include <iostream>
#include <algorithm>
#define EPS 1.0e-8
#define PI acos(-1.0)
#define INF 3000000000
#define MOD 1000000009
#define mem(a,b) memset((a),b,sizeof(a))
#define TS printf("!!!\n")
#define pb push_back
//using ll = long long;
//using ull= unsigned long long;
//std::ios::sync_with_stdio(false);
using namespace std;
//priority_queue<int,vector<int>,greater<int>> que; //min
typedef long long ll;
typedef unsigned long long ull;
bool cmplow(int a,int b)
{
return a<b;
}
int num[];
int main()
{
freopen("bulls.in", "r", stdin);
freopen("bulls.out", "w", stdout);
mem(num,);
string a,b;
cin >> a >> b;
int n=,m=;
for(int i=;i<;i++)
{
num[a[i]-'']++;
}
for(int i=;i<;i++)
{
if(a[i]==b[i])
{
n++;
}
else
{
if(num[b[i]-'']!=)
m++;
}
}
cout<< n <<" "<< m;
}
B:要先搜 再记录路径 因为可走不代表是可行解 要后面门全部走完才能记录
include <bits/stdc++.h>
#include <cstring>
#include <iostream>
#include <algorithm>
#define EPS 1.0e-8
#define PI acos(-1.0)
#define INF 3000000000
#define MOD 1000000009
#define mem(a,b) memset((a),b,sizeof(a))
#define TS printf("!!!\n")
#define pb push_back
#define pai pair<int,int>
//using ll = long long;
//using ull= unsigned long long;
//std::ios::sync_with_stdio(false);
using namespace std;
//priority_queue<int,vector<int>,greater<int>> que; //min
typedef long long ll;
typedef unsigned long long ull;
struct way
{
int to;
int val;
}w[];
int ans[];
int pop=;
void dfs(int x)
{
for(int gate=*x-;gate<=*x;gate++)
{
if(w[gate].val==)
{
w[w[gate].to].val=;
w[gate].val=;
dfs((w[gate].to+)/);
ans[pop++]=w[gate].to;
ans[pop++]=gate;
}
}
}
int main()
{
freopen("courier.in", "r", stdin);
freopen("courier.out", "w", stdout);
mem(ans,);
mem(w,);
int n;
cin >> n;
for(int i=;i<=*n;i++)
{
int now,next;
scanf("%d %d",&now,&next);
w[now].to=next;
w[next].to=now;
w[now].val=w[next].val=;
}
dfs();
for(int i=;i<=*n;i++)
{
if(w[i].val==)
{
cout<<"No"<<endl;
return ;
}
}
cout<<"Yes"<<endl;
cout<<ans[];
for(int i=;i<=*n;i++)
{
cout<<" "<<ans[i];
}
}
C:没遇到一个转折点就往前和往后推
#include <bits/stdc++.h>
#include <cstring>
#include <iostream>
#include <algorithm>
#define EPS 1.0e-8
#define PI acos(-1.0)
#define INF 3000000000
#define MOD 1000000009
#define mem(a,b) memset((a),b,sizeof(a))
#define TS printf("!!!\n")
#define pb push_back
//using ll = long long;
//using ull= unsigned long long;
//std::ios::sync_with_stdio(false);
using namespace std;
//priority_queue<int,vector<int>,greater<int>> que; //min
typedef long long ll;
typedef unsigned long long ull;
int a[];
int ans[];
int pop=;
int main()
{
freopen("dales.in", "r", stdin);
freopen("dales.out", "w", stdout);
int t;
cin>> t;
while(t--)
{
int n;
cin >> n;
for(int i=;i<=n;i++)
scanf("%d",&a[i]);
int h=,d=;
for(int i=;i<n;i++)
{
if(a[i]>a[i-]&&a[i]>a[i+])
{
int now1,now2;
for(now1=i-;now1>;now1--)
{
if(a[now1]>=a[now1+])
break;
}
for(now2=i+;now2<=n;now2++)
{
if(a[now2]>=a[now2-])
break;
}
h=max(h,min(now2-i-,i-now1-));
}
else if(a[i]<a[i-]&&a[i]<a[i+])
{
int now1,now2;
for(now1=i-;now1>;now1--)
{
if(a[now1]<=a[now1+])
break;
}
for(now2=i+;now2<=n;now2++)
{
if(a[now2]<=a[now2-])
break;
}
d=max(d,min(now2-i-,i-now1-));
}
}
cout<<h<<" "<<d<<endl;
}
}
D:暴力打表找规律
1->2->4->10->32->122->544->2770->15872->101042->707584->5405530......要算ans[x] i从1开始到x-2 add=ans[i]*ans[x-1-i]/2*C(x-1,i) if(i!=1&&(x-i-i)!=1) add/=2 ans+=add;
#include <bits/stdc++.h>
#include <cstring>
#include <iostream>
#include <algorithm>
#define EPS 1.0e-8
#define PI acos(-1.0)
#define INF 3000000000
#define MOD 1000000009
#define mem(a,b) memset((a),b,sizeof(a))
#define TS printf("!!!\n")
#define pb push_back
#define pai pair<int,int>
//using ll = long long;
//using ull= unsigned long long;
//std::ios::sync_with_stdio(false); using namespace std;
//priority_queue<int,vector<int>,greater<int>> que; //min
typedef long long ll;
typedef unsigned long long ull;
struct way
{
int to;
int val;
}w[];
int ans[];
int pop=;
void dfs(int x)
{
for(int gate=*x;gate>=*x-;gate--)
{
if(w[gate].val==)
{
w[w[gate].to].val=;
w[gate].val=;
dfs((w[gate].to+)/);
ans[pop++]=w[gate].to;
ans[pop++]=gate;
}
}
}
int main()
{
freopen("courier.in", "r", stdin);
freopen("courier.out", "w", stdout);
mem(ans,);
mem(w,);
int n;
cin >> n;
for(int i=;i<=*n;i++)
{
int now,next;
scanf("%d %d",&now,&next);
w[now].to=next;
w[next].to=now;
w[now].val=w[next].val=;
}
dfs();
for(int i=;i<=*n;i++)
{
if(w[i].val==)
{
cout<<"No"<<endl;
return ;
}
}
cout<<"Yes"<<endl;
cout<<ans[];
for(int i=;i<=*n;i++)
{
cout<<" "<<ans[i];
}
}
F:打表约数 枚举
G:数位DP
Summer training #11的更多相关文章
- 2017ecjtu-summer training # 11 POJ 2492
A Bug's Life Time Limit: 10000MS Memory Limit: 65536K Total Submissions: 38280 Accepted: 12452 D ...
- 2017ecjtu-summer training #11 POJ 1018
Communication System Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 29218 Accepted: ...
- 壁虎书4 Training Models
Linear Regression The Normal Equation Computational Complexity 线性回归模型与MSE. the normal equation: a cl ...
- Todo List
Contest 11.13 2016ACM/ICPC亚洲区青岛站(5/13, solved 7/13) Training 11.06 2016年中国大学生程序设计竞赛(合肥)(solved 6/10) ...
- 每日英语:Boost Your Balance; Avoid Falls
If you find yourself needing to sit down to take off your shoes, it might be time to start paying at ...
- PyTorch中的Batch Normalization
Pytorch中的BatchNorm的API主要有: 1 torch.nn.BatchNorm1d(num_features, 2 3 eps=1e-05, 4 5 momentum=0.1, 6 7 ...
- 地区sql
/*Navicat MySQL Data Transfer Source Server : localhostSource Server Version : 50136Source Host : lo ...
- 2014 Multi-University Training Contest 9#11
2014 Multi-University Training Contest 9#11 Killing MonstersTime Limit: 2000/1000 MS (Java/Others) ...
- 【Android Developers Training】 11. 支持不同语言
注:本文翻译自Google官方的Android Developers Training文档,译者技术一般,由于喜爱安卓而产生了翻译的念头,纯属个人兴趣爱好. 原文链接:http://developer ...
随机推荐
- lua学习笔记1--基础语法
print("打印日志");--单行注释 --[[ 多行注释 --]] a = --变量的类型,是由变量储存的数据决定 数据类型: number:数值类型,可以存储整数和小数 bo ...
- 安装gnocchi
在控制节点上执行 #!/bin/bash MYSQL_ROOT_PASSWD='m4r!adbOP' GNOCCHI_PASSWD='gnocchi1234!' CEILOMETER_PASSWD=' ...
- 【VS开发】OpenCV2:Mat属性type,depth,step
OpenCV2:Mat属性type,depth,step 在OpenCV2中Mat类无疑使占据着核心地位的,前段时间初学OpenCV2时对Mat类有了个初步的了解,见OpenCV2:Mat初学.这几天 ...
- Consecutive Numbers Sum
Given a positive integer N, how many ways can we write it as a sum of consecutive positive integers? ...
- 【转帖】docker-get拉取镜像
docker-get拉取镜像 题目很诱人 找时间测试一下 是否可以翻越长城下载镜像. https://www.cnblogs.com/fuyuteng/p/10904495.html docker-g ...
- P1616 疯狂的采药 (完全背包优化)
(点击此处查看原题) 题意 简单来说,就是一个完全背包,不过这里卡住了常规的完全背包写法,时间复杂度为O( V*∑( V/c[i] ))如下所示: ;i <= n ;i ++) { scanf( ...
- redis 命令 setbit、bitcount、getbit、bitop
1.SETBIT key offset value 对 key 所储存的字符串值,设置或清除指定偏移量上的位(bit). 在redis中,存储的字符串都是以二级制的进行存在的. 举例: 设置一个 ke ...
- Spring实战(六)自动装配的歧义性
1.Spring进行自动装配时碰到的bean歧义性问题. 在进行自动装配时,只有仅有一个bean匹配所需结果时,才是可行的. 如果不仅仅一个bean能够匹配结果,例如一个接口有多个实现,这种歧义性会阻 ...
- Neo4j图数据库配置文件详解
For more details and a complete list of settings, please see https://neo4j.com/docs/operations-manua ...
- hdu 6025(女生赛)
典型的用空间换取时间的思想 关键要理解多个数怎么算最小公倍数 用一个前缀 一个后缀 然后枚举去掉的点就可以了 #include <iostream> #include <cstdio ...