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 ...
随机推荐
- STS如何将一个文件夹设置缺省的创建路径(build path)
STS中的build path是一种缺省的路径,相当于windows的环境变量中的path,利用它可以将jsp等文件放入其中,程序只需要文件名就可以找到它. (1)在Package Explorer中 ...
- 2019-2020 ICPC, Asia Jakarta Regional Contest C. Even Path
Pathfinding is a task of finding a route between two points. It often appears in many problems. For ...
- Data Exfiltration with DNS in MSSQL SQLi attacks
DNS解析过程 DNS解析过程 DNS 查询的过程如下图1所示. 图1 文字举例说明: 假定浏览器想知道域名xprp8i.dnslog.cn的IP地址. 1.浏览器先向本地DNS服务器进行递归查询. ...
- 记录运行时间 StopWatch
- addRoutes进行权限控制
用addRoutes实现动态路由:https://www.jianshu.com/p/0bea4a1b0350 详解基于vue,vue-router, vuex以及addRoutes进行权限控制:ht ...
- Vue-cli3性能优化
Vue-cli3.0的打包性能优化方案:https://juejin.im/post/5d42962be51d4561b84c00c3 提升90%加载速度——vuecli下的首屏性能优化:https: ...
- 网络流三大算法【邻接矩阵+邻接表】POJ1273
网络流的基本概念跟算法原理我是在以下两篇博客里看懂的,写的非常好. http://www.cnblogs.com/ZJUT-jiangnan/p/3632525.html http://www.cnb ...
- OS X更新Catalina 10.15.2后虚拟机黑屏(已解决)
简述 问题:更新OS X 10.15.2后VM Ware进unbuntu 16.0黑屏,但是VM Ware 有显示,情况类似如下: 解决办法 重启系统,command+r 进入恢复模式,打开bas ...
- python报错及处理 -- 不断总结
ModuleNotFoundError: No module named 'PIL' 解决方法: 运行命令:pip install Pillow IndentationError: expected ...
- 小菜鸟之HTML第三课
jquery的引入 <!DOCTYPE html> <html lang="en"> <head> <meta charset=" ...