A:Pythagoras's Revenge

代码:

 #include<cstdio>
#define ll long long
using namespace std;
int main()
{
ll a;
while(scanf("%lld",&a)!=EOF)
{
if (a==) break;
ll aa=a*a;
int ans=;
for(ll i=;i<a;i++)
{
ll x=i;
if (aa%i!=) continue;
ll y=aa/i;
if ((x+y)*(y-x)%!=) continue;
if ((y-x)/>a) ans++;
}
printf("%d\n",ans);
}
return ;
}

B:Digit Solitaire

代码:

 #include<cstdio>
using namespace std; int main()
{
int b;
while(scanf("%d",&b)&&b)
{
printf("%d",b);
while(b/>)
{
int tmp=;
while(b>)
{
tmp*=b%;
b/=;
}
b=tmp;
printf(" %d",tmp);
}
printf("\n");
}
return ;
}

C:Any Way You Slice It

计算几何

代码:

 #include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#define maxn 150
#define pi acos(-1)
#define eps 1e-5
using namespace std; struct point
{
double x,y;
point(double x=,double y=):x(x),y(y){}
} p[maxn];
point operator-(point a,point b){return point(a.x-b.x,a.y-b.y);}
double cross(point a,point b){return a.x*b.y-a.y*b.x;}
int dcmp(double x)
{
if(fabs(x)<eps)return ;
else return x<?-:;
}
bool xiangjiao(point a1,point a2,point b1,point b2)
{
double c1=cross(a2-a1,b1-a1),c2=cross(a2-a1,b2-a1);
double c3=cross(b2-b1,a1-b1),c4=cross(b2-b1,a2-b1);
return dcmp(c1)*dcmp(c2)<&&dcmp(c3)*dcmp(c4)<;
} int main()
{
int n;
double d,x;
while(scanf("%d",&n)&&n)
{
bool flag=;
int ans=;
p[]= point(,);
double ang=pi/;
for(int i=; i<n; i++)
{
scanf("%lf%lf",&d,&x);
ang+=d/*pi;
p[i+].x=p[i].x+cos(ang)*x;
p[i+].y=p[i].y+sin(ang)*x;
if(i>&&flag==)
{
for(int j=; j<i; j++)
{
if(xiangjiao(p[j],p[j+],p[i],p[i+])==)
{
flag=;
ans=i+;
}
}
} }
if(flag==)puts("SAFE");
else printf("%d\n",ans);
}
return ;
}

D:Is the Name of This Problem

代码:

 #include<cstdio>
#include<cstring>
#include<string>
#include<iostream>
#define maxn 109
using namespace std; char s1[maxn];
char s2[maxn];
int main()
{
// freopen("in.txt","r",stdin);
while(gets(s1))
{
bool flag=;
memset(s2,,sizeof s2);
if(s1[]=='E'&&s1[]=='N'&&s1[]=='D'&&!s1[])break;
int l=strlen(s1);
if(s1[]!='\"')
{
puts("not a quine");
continue;
}
int i,cnt=;
for(i=; i<l; i++)
{
if(s1[i]=='\"')break;
s2[cnt++]=s1[i];
}
if(cnt==)
{
puts("not a quine");
continue;
}
i++;
if(s1[i]!=' ')
{
flag=;
}
i++;
int j=;
for(;j<cnt;j++)
{
if(s2[j]>='A'&&s2[j]<='Z')continue;
else if(s2[j]==' ')continue;
else
{
flag=;break;
}
}
j=;
for(;i<l;i++)
{
if(s1[i]!=s2[j])
{
flag=;break;
}
j++;
if(j>cnt){flag=;break;}
}
if(j<cnt)flag=;
if(flag)printf("Quine(%s)\n",s2);
else puts("not a quine");
}
return ;
}
#include<cstdio>
#include<cstring>
#include<string>
#include<iostream>
#define maxn 109
using namespace std; char s1[maxn];
char s2[maxn];
int main()
{
// freopen("in.txt","r",stdin);
while(gets(s1))
{
bool flag=;
memset(s2,,sizeof s2);
if(s1[]=='E'&&s1[]=='N'&&s1[]=='D'&&!s1[])break;
int l=strlen(s1);
if(s1[]!='\"')
{
puts("not a quine");
continue;
}
int i,cnt=;
for(i=; i<l; i++)
{
if(s1[i]=='\"')break;
s2[cnt++]=s1[i];
}
if(cnt==)
{
puts("not a quine");
continue;
}
i++;
if(s1[i]!=' ')
{
flag=;
}
i++;
int j=;
for(;j<cnt;j++)
{
if(s2[j]>='A'&&s2[j]<='Z')continue;
else if(s2[j]==' ')continue;
else
{
flag=;break;
}
}
j=;
for(;i<l;i++)
{
if(s1[i]!=s2[j])
{
flag=;break;
}
j++;
if(j>cnt){flag=;break;}
}
if(j<cnt)flag=;
if(flag)printf("Quine(%s)\n",s2);
else puts("not a quine");
}
return ;
}

F:LRU Caching

代码:

 #include<cstdio>
#include<cstring>
#include<algorithm>
#define maxn 1000009
using namespace std;
int frecount;
int n;
struct node
{
int id;
int fre;
bool operator <(const node &t)const
{
return fre<t.fre;
}
} no[]; void shuchu()
{
sort(no,no+n);
for(int i=; i<n; i++)
{
if(no[i].id>)
printf("%c",no[i].id+'A'-);
}
puts("");
} void add(char s)
{
bool flag=;
frecount++;
for(int i=; i<n; i++)
if(no[i].id==s-'A'+)
{
no[i].fre=frecount;
flag=;
break;
}
if(flag==)
{
sort(no,no+n);
no[].id=s-'A'+;
no[].fre=frecount;
}
} char s[maxn]; int main()
{
// freopen("in.txt","r",stdin);
int ca=;
while(scanf("%d",&n)&&n)
{
printf("Simulation %d\n",ca++);
frecount=;
for(int i=; i<n; i++)
{
no[i].id=-;
no[i].fre=-;
}
scanf("%s",s);
int l=strlen(s);
for(int i=; i<l; i++)
{
if(s[i]=='!')
shuchu();
else add(s[i]);
}
}
return ;
}

G:Jugglefest

代码:

 #include<cstdio>
#include<cstring>
using namespace std;
int p[];
char s[];
int main()
{
// freopen("in.txt","r",stdin);
int n;
while(scanf("%d",&n)&&n)
{
bool flag=;
memset(p,,sizeof p);
memset(s,,sizeof s);
for(int i=; i<n; i++)
{
scanf("%d",&p[i]);
}
int cnt=,num=;
for(int i=; i<; i++)
{
if(s[i]==)s[i]='A'+cnt++;
if(s[i+p[num%n]]!=&&(i+p[num%n]<))flag=;
else s[i+p[num%n]]=s[i];
num++;
}
if(flag)
{
for(int i=;i<;i++)
putchar(s[i]);
puts("");
}
else puts("CRASH");
}
return ;
}

四校训练 warm up 14的更多相关文章

  1. HDU6621 K-th Closest Distance HDU2019多校训练第四场 1008(主席树+二分)

    HDU6621 K-th Closest Distance HDU2019多校训练第四场 1008(主席树+二分) 传送门:http://acm.hdu.edu.cn/showproblem.php? ...

  2. HDU6578 2019HDU多校训练赛第一场 1001 (dp)

    HDU6578 2019HDU多校训练赛第一场 1001 (dp) 传送门:http://acm.hdu.edu.cn/showproblem.php?pid=6578 题意: 你有n个空需要去填,有 ...

  3. [源码解析] 深度学习分布式训练框架 horovod (14) --- 弹性训练发现节点 & State

    [源码解析] 深度学习分布式训练框架 horovod (14) --- 弹性训练发现节点 & State 目录 [源码解析] 深度学习分布式训练框架 horovod (14) --- 弹性训练 ...

  4. HDU6579 2019HDU多校训练赛第一场1002 (线性基)

    HDU6579 2019HDU多校训练赛第一场1002 (线性基) 传送门:http://acm.hdu.edu.cn/showproblem.php?pid=6579 题意: 两种操作 1.在序列末 ...

  5. HDU 4902 Nice boat 2014杭电多校训练赛第四场F题(线段树区间更新)

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4902 解题报告:输入一个序列,然后有q次操作,操作有两种,第一种是把区间 (l,r) 变成x,第二种是 ...

  6. 2018牛客网暑假ACM多校训练赛(第四场)B Interval Revisited 动态规划

    原文链接https://www.cnblogs.com/zhouzhendong/p/NowCoder-2018-Summer-Round4-B.html 题目传送门 - https://www.no ...

  7. 2018牛客网暑假ACM多校训练赛(第四场)C Chiaki Sequence Reloaded (组合+计数) 或 数位dp

    原文链接https://www.cnblogs.com/zhouzhendong/p/NowCoder-2018-Summer-Round4-C.html 题目传送门 - https://www.no ...

  8. 2018牛客网暑假ACM多校训练赛(第四场)E Skyline 线段树 扫描线

    原文链接https://www.cnblogs.com/zhouzhendong/p/NowCoder-2018-Summer-Round4-E.html 题目传送门 - https://www.no ...

  9. 2018牛客网暑假ACM多校训练赛(第四场)A Ternary String 数论

    原文链接https://www.cnblogs.com/zhouzhendong/p/NowCoder-2018-Summer-Round4-A.html 题目传送门 - https://www.no ...

随机推荐

  1. Kafka 0.8: 多日志文件夹机制

    kafka 0.7.2 中对log.dir的定义如下: log.dir none Specifies the root directory in which all log data is kept. ...

  2. 玩转Android之数据库框架greenDAO3.0使用指南

    用过ActiveAndroid.玩过ORMLite,穿过千山万水,最终还是发现greenDAO好用,ActiveAndroid我之前有一篇文章介绍过 玩转Android之数据库框架ActiveAndr ...

  3. Docker中开启sshd服务

    ssh服务安装 安装ssh服务 #yum install openssh-server -y 安装passwd(修改密码需要) #yum install passwd -y 修改sshd_config ...

  4. OpenJDK1.8 安装

    1. 安装JDK yum install -y java-1.8.0-openjdk-devel 2. 设置环境变量 /etc/profile文件增加 export JAVA_HOME=/usr/li ...

  5. day-3

    /* 快noip了!!!感觉还有好多事要做 上午考试 原题没做 自己找了套题 挺水的 T1模拟(然而没认真读题 90) T2 dp+简单优化 数据有点问题 T3 暴力状丫 然而写丑了 60分的要两秒多 ...

  6. 快速预览:C# 3.0的新东西

    Lambda 表达式: Func<string, string> doubleAppend= x => x + x; Console.WriteLine (doubleAppend( ...

  7. Multiple methods named 'status' found with mismatched result, parameter type or attributes

    出现这个这个错误, 有可能是由于你直接通过一个数组的索引获取一个对象(或模型)然后直接调用这个对象(或模型)的某个方法 例如: NSString *status = [self.models[inde ...

  8. C#下如何用NPlot绘制期货股票K线图(2):读取数据文件让K线图自动更新

    [内容介绍]上一篇介绍了K线图的基本绘制方法,但很不完善,本篇增加了它直接读取数据的功能,这对于金融市场的数据量大且又需要动态刷新功能的实现很重要. [实现方法] 1.需要一个数据文件,这里用的是直接 ...

  9. PHP pear安装出现 Warning: require_once(Structures/Graph.php)...错误

    今天在WINDOWS安装pear,一路无阻很顺利安装完成,接着想安装下pear email包来玩下,但接下来却报: Warning: require_once(Structures/Graph.php ...

  10. java 利用注解实现BaseDao 增删查改

    第一步,编写两个注解类,用于表明实体类对应的表名及字段. TableInfo.java 此注解用于标注表名及主键名 import static java.lang.annotation.Element ...