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. css盒子模型基础,margin-top塌陷,元素溢出

    现在布局不用table,一般用盒子模型来布局,也就是通常说的div+css,一个页面就是多个盒子的拼接   一. 初识盒子模型   例子1,测试盒子各属性设置   <head> <s ...

  2. java里面的标识符、关键字和类型

    1. 注释  Java中有三种注释:   (1) // -单行注释,注释从“//”开始,终止于行尾:   (2)  -多行注释,注释从““结束:   (3)  -是Java特有的doc注释,这种注释主 ...

  3. screen新建窗口,环境变量跟原来不一致。

    昨天为了方便npm安装全局包,我把环境变量重新配置了. 然后,在项目中引用全局包没有出问题.但是后来我在screen里面引用全局包,报错说找不到. 使用#npm list -g命令 发现昨天的全局包都 ...

  4. QQ第三方登陆示例

    先上图 若想实现QQ登录,需要成为QQ互联的开发者,审核通过才可实现.注册方法可参考链接http://wiki.connect.qq.com/%E6%88%90%E4%B8%BA%E5%BC%80%E ...

  5. getLong not implemented for class oracle.jdbc.driver.T4CRowidAccessor

    症状: SpringMVC+MyBatis向数据库插入数据,主键应用ORACLE中自己设置的自增序列会发生如下错误: nested exception is Java.sql.SQLException ...

  6. paraview isosurface

    参考:https://www.youtube.com/watch?v=UjoSvWdxlTA

  7. jdbc连接oracle的url的三种写法

    JDBC 链接oracle的三种URL写法 1.普通SID方式     jdbc:oracle:thin:username/password@x.x.x.1:1521:SID 2.普通ServerNa ...

  8. [转] Java 命令行交互-JCommander

    [From] https://github.com/Sayi/sayi.github.com/issues/32 我喜欢简单,什么是简单?正如若干字符组成的命令行. 有时候我们用Java开发了一个小工 ...

  9. 关于dedecms数据量大以后生成目录缓慢的问题解决

    四月份的时候博客被封.我不知情.因为一直很忙,没有来得及看.前两天来看以后,发现居然被封,吓傻了我. 赶紧找原因,原来是转载了某个人的博文,被他举报了,然后就被封了. 觉得很伤心,毕竟这个博客陪伴了我 ...

  10. 如何统计Visual Studio Code项目的代码行数

    背景 年底到了,公司一年一度做述职报告的时间又到了,每到此时小伙伴们都想方设法的去做一些代码层面的汇总.在此交给大家个小妙招,走过路过不要错过哈,, 解决方案 使用Visual Studio Code ...