训练赛题目

 
A题代码:
 #include <bits/stdc++.h>

 using namespace std;

 int main()
{
double n,m;
freopen("input.txt","r",stdin);
freopen("output.txt","w",stdout);
while(cin>>n>>m){
cout<<max(ceil(n*2.0/m),2.0)<<endl;
}
}

D题代码:

方法一 数学方法

 #include <bits/stdc++.h>
using namespace std;
int pow2(int a,int b)
{
int ans =;
for(int i=;i<=b;i++)
ans=(ans*)%();
return ans;
}
int main()
{
freopen("input.txt","r",stdin);
freopen("output.txt","w",stdout);
string s;
cin>>s;
int ans=;
for(int i=;i<s.size();i++)
{
if((s[i]=='N'||s[i]=='S') &&(s[i+]=='W'||s[i+]=='E'))
ans=(ans+)%; }
long long a1=(long long)pow2(,ans)%();
cout<<a1<<endl; return ;
}

方法二 递推思想

 #include <bits/stdc++.h>
using namespace std;
#define mod 1000000007
int main()
{
freopen("input.txt","r",stdin);
freopen("output.txt","w",stdout);
char s[];
cin>>s;
int a[];
int s1=strlen(s);
a[]=a[]=;
for(int i=;i<=s1;i++)
{
if((s[i-]=='N'||s[i-]=='S') &&(s[i]=='W'||s[i]=='E'))
a[i+]=(a[i]+a[i-])%mod;
else
a[i+]=a[i];
}
cout<<a[s1]<<endl;
return ;
}

G题:一个数是 三个素数的乘积

 #include <bits/stdc++.h>
using namespace std; int main()
{
freopen("input.txt","r",stdin);
freopen("output.txt","w",stdout);
int n;
bool flag;
while(cin>>n)
{
int cnt=;
for(int i=; i*i<=n; i++)
{
flag=;
while(n%i==)
{
if(flag)
{
cnt++;
flag=;
}
n/=i;
}
}
if(n!=) cnt++;
if(cnt==) cout<<"YES"<<endl;
else cout<<"NO"<<endl;
}
return ;
}

ACM 第十三天的更多相关文章

  1. hdu 1292 &quot;下沙野骆驼&quot;ACM夏令营 (递推)

    "下沙野骆驼"ACM夏令营 Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/ ...

  2. CRL快速开发框架系列教程十三(嵌套查询)

    本系列目录 CRL快速开发框架系列教程一(Code First数据表不需再关心) CRL快速开发框架系列教程二(基于Lambda表达式查询) CRL快速开发框架系列教程三(更新数据) CRL快速开发框 ...

  3. SCNU ACM 2016新生赛决赛 解题报告

    新生初赛题目.解题思路.参考代码一览 A. 拒绝虐狗 Problem Description CZJ 去排队打饭的时候看到前面有几对情侣秀恩爱,作为单身狗的 CZJ 表示很难受. 现在给出一个字符串代 ...

  4. 我的MYSQL学习心得(十三) 权限管理

    我的MYSQL学习心得(十三) 权限管理 我的MYSQL学习心得(一) 简单语法 我的MYSQL学习心得(二) 数据类型宽度 我的MYSQL学习心得(三) 查看字段长度 我的MYSQL学习心得(四) ...

  5. SCNU ACM 2016新生赛初赛 解题报告

    新生初赛题目.解题思路.参考代码一览 1001. 无聊的日常 Problem Description 两位小朋友小A和小B无聊时玩了个游戏,在限定时间内说出一排数字,那边说出的数大就赢,你的工作是帮他 ...

  6. acm结束了

    最后一场比赛打完了.之前为了记录一些题目,开了这个博客,现在结束了acm,这个博客之后也不再更新了. 大家继续加油!

  7. 关于ACM的总结

    看了不少大神的退役帖,今天终于要本弱装一波逼祭奠一下我关于ACM的回忆. 从大二上开始接触到大三下结束,接近两年的时间,对于大神们来说两年的确算不上时间,然而对于本弱来说就是大学的一半时光.大一的懵懂 ...

  8. 第一届山东省ACM——Phone Number(java)

    Description We know that if a phone number A is another phone number B’s prefix, B is not able to be ...

  9. 第一届山东省ACM——Balloons(java)

    Description Both Saya and Kudo like balloons. One day, they heard that in the central park, there wi ...

随机推荐

  1. python学习——模块和包

    在之前常用模块中我们已经初步了解了模块的导入,今天来说学习一下模块和包.我们可以把模块理解成每一个python文件.而包就是多个能解决一类问题的python文件全部放在一起.OK

  2. gem install tiny_tds失败

    解决: brew install freetds gem install tiny_tds -v '2.1.0'

  3. Leecode刷题之旅-C语言/python-206反转链表

    /* * @lc app=leetcode.cn id=206 lang=c * * [206] 反转链表 * * https://leetcode-cn.com/problems/reverse-l ...

  4. Codeforces Round #482 (Div. 2) : Kuro and GCD and XOR and SUM (寻找最大异或值)

    题目链接:http://codeforces.com/contest/979/problem/D 参考大神博客:https://www.cnblogs.com/kickit/p/9046953.htm ...

  5. Hibernate学习笔记一

    1 框架体系结构 2 hibernate入门 2.1 ORM框架 Hibernate是一个数据持久化层的ORM框架. Object:对象,java对象,此处特指JavaBean Relational: ...

  6. VS2015编译MapWinGIS

    在github上下载MapWinGIS,目前最新版本为4.9.5.0 GitHub上项目地址为:https://github.com/MapWindow/MapWinGIS 通过git客户端下载mas ...

  7. 下载地图瓦片(包括各种格式的,Openstreetmap,googlemap, bingmap)

    参考第三方开源库Brutile 个人的程序托管在github上

  8. Codeforces Round #460 (Div. 2) 前三题

    Problem A:题目传送门 题目大意:给你N家店,每家店有不同的价格卖苹果,ai元bi斤,那么这家的苹果就是ai/bi元一斤,你要买M斤,问最少花多少元. 题解:贪心,找最小的ai/bi. #in ...

  9. struts2-01:作用域传值

    方式一.使用ServletActionContext(耦合度高,不建议使用) public String login(){ ServletActionContext.getRequest().getS ...

  10. pip源设置 & pandas安装

    pip的官方源python.pypi.org貌似被墙,换用国内安装源 网上的设置方法都是基于Unix的,Windows下的设置略麻烦. 更新..\Lib\site-packages\pip下的cmdo ...