A - Megacity

sqrtf是个坑

#include <iostream>
#include <string>
#include <cstring>
#include <cstdlib>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <stack>
#include <queue>
#include <cctype>
#include <vector>
#include <iterator>
#include <set>
#include <map>
#include <sstream>
using namespace std; #define mem(a,b) memset(a,b,sizeof(a))
#define pf printf
#define sf scanf
#define spf sprintf
#define pb push_back
#define debug printf("!\n")
#define INF 10000
#define MAXN 5010
#define MAX(a,b) a>b?a:b
#define blank pf("\n")
#define LL long long
#define ALL(x) x.begin(),x.end()
#define INS(x) inserter(x,x.begin())
#define pqueue priority_queue int n,s; struct point
{
int x,y,h;
double d;
}p[]; int cmp(const point& a,const point& b)
{ return a.d<=b.d;} int main()
{
int i,j;
while(sf("%d%d",&n,&s)==)
{
if(s == )
{
pf("%.7f\n",);
continue;
}
mem(p,); for(i=;i<n;i++)
{
sf("%d%d%d",&p[i].x,&p[i].y,&p[i].h);
p[i].d = sqrtf(p[i].x*p[i].x + p[i].y*p[i].y);
}
sort(p,p+n,cmp); int sum = s;
double res = ;
int ok = ; for(i=;i<n;i++)
{
sum+=p[i].h;
if(sum>=)
{
ok = ;
res = p[i].d;
break;
}
}
if(ok)
{
pf("%.7f\n",res);
}
else
pf("-1\n");
}
}

B - Let's Watch Football

一看就知道可以计算,不要想太复杂

int main()
{
int i,j;
int a,b,c;
while(sf("%d%d%d",&a,&b,&c)==)
{
pf("%d\n",(a*c-b*c+b-)/b);
}
}

C - Hopscotch

#include <iostream>
#include <string>
#include <cstring>
#include <cstdlib>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <stack>
#include <queue>
#include <cctype>
#include <vector>
#include <iterator>
#include <set>
#include <map>
#include <sstream>
using namespace std; #define mem(a,b) memset(a,b,sizeof(a))
#define pf printf
#define sf scanf
#define spf sprintf
#define pb push_back
#define mp make_pair
#define debug printf("!\n")
#define INF 1<<30
#define MAXN 5010
#define MAX(a,b) a>b?a:b
#define blank pf("\n")
#define LL long long
#define ALL(x) x.begin(),x.end()
#define INS(x) inserter(x,x.begin())
#define pqueue priority_queue int main()
{
int T,r,i,j,n;
int a,x,y;
while(sf("%d%d%d",&a,&x,&y)==)
{
if(y%a==)
pf("-1\n");
else if(y<a)
{
if(*x<a && *x>-a)
pf("1\n");
else
pf("-1\n");
}
else
{
if((y-a)/a%==)
{
if(*x<a && *x>-a)
pf("%d\n",(y-a)/a/*+);
else
pf("-1\n");
}
else
{
if(x> && x<a)
pf("%d\n",((y-a)/a+)/*+);
else if(x< && x>-a)
pf("%d\n",((y-a)/a+)/*);
else
pf("-1\n");
}
}
}
}

Working out

#include <iostream>
#include <string>
#include <cstring>
#include <cstdlib>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <stack>
#include <queue>
#include <cctype>
#include <vector>
#include <iterator>
#include <set>
#include <map>
#include <sstream>
using namespace std; #define mem(a,b) memset(a,b,sizeof(a))
#define pf printf
#define sf scanf
#define spf sprintf
#define pb push_back
#define debug printf("!\n")
#define INF 10000
#define MAXN 5010
#define MAX(a,b) a>b?a:b
#define blank pf("\n")
#define LL long long
#define ALL(x) x.begin(),x.end()
#define INS(x) inserter(x,x.begin())
#define pqueue priority_queue int n,m; int a[][]; int dp[][][]; int main()
{
int i,j;
while(sf("%d%d",&n,&m)==)
{
for(i=;i<=n;i++)
{
for(j=;j<=m;j++)
{
sf("%d",&a[i][j]);
}
} for(i=;i<=n;i++)
{
for(j=;j<=m;j++)
{
dp[i][j][] = max(dp[i-][j][],dp[i][j-][])+a[i][j];
}
} for(i=n;i>=;i--)
{
for(j=m;j>=;j--)
{
dp[i][j][] = max(dp[i+][j][],dp[i][j+][])+a[i][j];
}
} for(i=;i<=n;i++)
{
for(j=m;j>=;j--)
{
dp[i][j][] = max(dp[i-][j][],dp[i][j+][])+a[i][j];
}
} for(i=n;i>=;i--)
{
for(j=;j<=m;j++)
{
dp[i][j][] = max(dp[i+][j][],dp[i][j-][])+a[i][j];
}
} int ans = ; for(i=;i<n;i++)
{
for(j=;j<m;j++)
{
ans = max(ans,dp[i][j-][]+dp[i][j+][]+dp[i-][j][]+dp[i+][j][]);
ans = max(ans,dp[i-][j][]+dp[i+][j][]+dp[i][j-][]+dp[i][j+][]);
}
} pf("%d\n",ans);
}
}

E - Anagram Search

打表法,因为?可以任意变,而且不在表范围内,所以只需要判断表范围内每个字母出现的数量

#include <iostream>
#include <string>
#include <cstring>
#include <cstdlib>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <stack>
#include <queue>
#include <cctype>
#include <vector>
#include <iterator>
#include <set>
#include <map>
#include <sstream>
using namespace std; #define mem(a,b) memset(a,b,sizeof(a))
#define pf printf
#define sf scanf
#define spf sprintf
#define pb push_back
#define mp make_pair
#define debug printf("!\n")
#define INF 1<<30
#define MAXN 5010
#define MAX(a,b) a>b?a:b
#define blank pf("\n")
#define LL long long
#define ALL(x) x.begin(),x.end()
#define INS(x) inserter(x,x.begin())
#define pqueue priority_queue char a[],b[]; int s[],t[]; int main()
{
int T,r,i,j,n;
while(sf("%s%s",a,b)==)
{
int al = strlen(a);
int bl = strlen(b); mem(s,);
mem(t,); for(i=;i<bl;i++)
{
if(b[i]!='?')
s[b[i]-'a']++;
} int cnt = ; for(i=;i<al;i++)
{
if(a[i]!='?') t[a[i]-'a']++;
int ok = ; if(i>=bl-)
{
for(j=;j<;j++)
{
if(t[j]>s[j])
{
ok = ;
break;
}
}
if(ok) cnt++;
t[a[i-bl+]-'a']--;
}
}
pf("%d\n",cnt);
}
}

SZU 7的更多相关文章

  1. P3436 [POI2006]PRO-Professor Szu

    P3436 [POI2006]PRO-Professor Szu 题目描述 n个别墅以及一个主建筑楼,从每个别墅都有很多种不同方式走到主建筑楼,其中不同的定义是(每条边可以走多次,如果走边的顺序有一条 ...

  2. SZU:B47 Big Integer II

    Judge Info Memory Limit: 32768KB Case Time Limit: 10000MS Time Limit: 10000MS Judger: Normal Descrip ...

  3. SZU:D89 The Settlers of Catan

    Judge Info Memory Limit: 65536KB Case Time Limit: 3000MS Time Limit: 3000MS Judger: Number Only Judg ...

  4. SZU:B47 Big Integer I

    Judge Info Memory Limit: 32768KB Case Time Limit: 10000MS Time Limit: 10000MS Judger: Normal Descrip ...

  5. SZU:G32 Mass fraction

    Judge Info Memory Limit: 32768KB Case Time Limit: 5000MS Time Limit: 5000MS Judger: Float Numbers (1 ...

  6. SZU:J38 Number Base Conversion

    Judge Info Memory Limit: 32768KB Case Time Limit: 1000MS Time Limit: 1000MS Judger: Number Only Judg ...

  7. SZU:B54 Dual Palindromes

    Judge Info Memory Limit: 32768KB Case Time Limit: 10000MS Time Limit: 10000MS Judger: Number Only Ju ...

  8. SZU:A66 Plastic Digits

    Description There is a company that makes plastic digits which are primarily put on the front door o ...

  9. SZU:G34 Love code

    Judge Info Memory Limit: 32768KB Case Time Limit: 10000MS Time Limit: 10000MS Judger: Normal Descrip ...

  10. SZU:A25 Favorite Number

    Judge Info Memory Limit: 32768KB Case Time Limit: 10000MS Time Limit: 10000MS Judger: Number Only Ju ...

随机推荐

  1. NTP搭建指南

    NTP搭建指南 前言: NTP是网络时间协议(Network Time Protocol),用于全球的标准时间(UTC)的校正. 一般NTP 服务有不同的层次:一层是源头NTP 服务器,一层服务器都设 ...

  2. python3入门之print,import,input介绍

    本节主要介绍print,import和input,t函数,包括他们在python2.7和python3 的区别以及用法.下面附有之前的文章: ​ python3的print函数的变化 python3之 ...

  3. inception_web

    1) wget --no-check-certificate https://bootstrap.pypa.io/ez_setup.py 2) python ez_setup.py --insecur ...

  4. 一个网站同一域名不同目录下的文件访问到的cookie值不同是什么原因?

    一个网站(e:\test):里面包含多个目录如: html css js php img ..... 等等.然后,我在js目录里面的js文件中设置了cookie:同样也在php目录中的php文件中设置 ...

  5. docker搭建elk+cerebro环境

    ELK的帮助手册 Docker Hub官网:https://hub.docker.com/r/sebp/elk/ Docker ELK使用文档:http://elk-docker.readthedoc ...

  6. 01-复杂度2 Maximum Subsequence Sum (25 分)

    Given a sequence of K integers { N​1​​, N​2​​, ..., N​K​​ }. A continuous subsequence is defined to ...

  7. Vue 1-- ES6 快速入门、vue的基本语法、vue应用示例,vue基础语法

    一.ES6快速入门 let和const let ES6新增了let命令,用于声明变量.其用法类似var,但是声明的变量只在let命令所在的代码块内有效. { let x = 10; var y = 2 ...

  8. ptyhon技能树及其学习资源

    GUI编程 tkinter Github项目 Tkinter by example effbot 文档 tkinter的一个designer,可以像在qtdesign那样创建UI文件 pyqt5 py ...

  9. myEclipse卡顿解决

    1 .关闭MyEclipse的自动validation windows > perferences > myeclipse > validation 将Build下全部勾取消 如果你 ...

  10. Zookeeper选举算法原理

    Zookeeper选举算法原理 Leader选举 Leader选举是保证分布式数据一致性的关键所在.当Zookeeper集群中的一台服务器出现以下两种情况之一时,需要进入Leader选举. (1) 服 ...