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. CF1059C Sequence Transformation 题解

    这几天不知道写点什么,状态也不太好,搬个题上来吧 题意:给定一个数n,设一个从1到n的序列,每次删掉一个序列中的数,求按字典序最大化的GCD序列 做法:按2的倍数找,但是如果除2能得到3的这种情况要特 ...

  2. 容器化VS微服务

    1 微服务 1.1 思想 开发人员自己测试.部署和运维自己编写的代码,即自己负责构建生命周期的全部. 1.2 Spring Boot 提供服务化的能力,即把容器.服务所需依赖和服务一起打包成一个jar ...

  3. (STM32F4) IAP程式碼實現

    IAP學習, 主要想了解實際上程式碼放在不同的Flash位置如何轉跳且執行. 我的應用程序只做了Pin12, Pin13 LED閃爍來分辨我的 App1 跟 App2的程式碼 App1 程式碼 int ...

  4. 扩展中国剩余定理 exCRT 学习笔记

    前言 由于 \(\{\mathrm{CRT}\}\subseteq\{\mathrm{exCRT}\}\),而且 CRT 又太抽象了,所以直接学 exCRT 了. 摘自 huyufeifei 博客 这 ...

  5. More Effective C++ 35个改善方法

    美·Scott Meyers 侯捷 More Exceptional C++: 40 New Engineering Puzzles, Programming Problems, and Soluti ...

  6. JAVA中 this关键字的用法

    this 在类中就是代表当前对象,可以通过 this 关键字完成当前对象的成员属性.成员方法和构造方法的调用. 那么何时用 this? 当在定义类中的方法时,如果需要调用该类对象,就可以用 this来 ...

  7. sql2008R2新建链接服务器。

    1:用sql新建链接服务器对象: /****** Object: LinkedServer [pad] Script Date: 10/23/2018 15:47:45 ******/ EXEC ma ...

  8. 二级C语言真题笔记

    二级C语言真题笔记 1. 知识重点:数据类型.循环.数组.函数.指针.结构体与共同体 2. 求程序的运行结果 #include <stdio.h> main() {     short i ...

  9. yum的repo文件详解、以及epel简介、yum源的更换

    一.什么是repo文件        repo文件是Fedora中yum源(软件仓库)的配置文件,通常一个repo文件定义了一个或者多个软件仓库的细节内容,例如我们将从哪里下载需要安装或者升级的软件包 ...

  10. chrome浏览器开发者工具(一)

    一.Elements 在Element中主要分两块大的部分:HTML结构面板和操作dom样式.结构.时间的显示面板 二.Network Network是一个监控当前网页所有的http请求的面版,它主体 ...