rank:

T1P1615 西游记公司

https://www.luogu.org/problemnew/show/P1615

scanf直接秒

 1 #include<iostream>
 2 #include<cstdio>
 3 #include<cstring>
 4 #include<cmath>
 5 #define LL long long
 6 using namespace std;
 7 inline LL read()
 8 {
 9     char c=getchar();LL x=0,f=1;
10     while(c<'0'||c>'9')    {if(c=='-')    f=-1;c=getchar();}
11     while(c>='0'&&c<='9')    x=x*10+c-48,c=getchar();return x*f;
12 }
13 int main()
14 {
15     LL a,b,c,d,e,f,n;
16     scanf("%lld:%lld:%lld%lld:%lld:%lld%lld",&a,&b,&c,&d,&e,&f,&n);
17     printf("%lld",n*(f-c+60*(e-b)+3600*(d-a)));
18     return 0;
19 }

View Code

T2P1838 三子棋I

https://www.luogu.org/problemnew/show/P1838

判断好每一种情况,不要忘了平局

 1 #include<iostream>
 2 #include<cstdio>
 3 #include<cstring>
 4 #include<cmath>
 5 #define LL  long long
 6 using namespace std;
 7 const int MAXN=201;
 8 inline int read()
 9 {
10     char c=getchar();int flag=1,x=0;
11     while(c<'0'||c>'9')    {if(c=='-')    flag=-1;c=getchar();}
12     while(c>='0'&&c<='9')    x=(x*10+c-48),c=getchar();    return x*flag;
13 }
14 int a[MAXN][MAXN];
15 char s[MAXN];
16 int hang[MAXN];
17 int lie[MAXN];
18 int hang2[MAXN];
19 int lie2[MAXN];
20 int main()
21 {
22     int n=3;
23     scanf("%s",s+1);
24     int now=1;
25     for(int i=1;i<=strlen(s+1);i++)
26     {
27         int p=(int)s[i]-48;
28         if(p%3!=0)
29         {
30             a[p/3+1][p%3]=now;
31             if(now==1)    hang[p/3+1]++,    lie[p%3]++;
32             else    hang2[p/+1]++,    lie2[p%3]++;
33         }
34         else
35         {
36             a[p/3][3]=now;
37             if(now==1)    hang[p/3]++,    lie[3]++;
38             else        hang2[p/3]++,    lie2[3]++;
39         }
40         if(now==1)    now=0;else now=1;
41     }
42     for(int i=1;i<=3;i++)
43         if(hang[i]==3||lie[i]==3)
44         {        printf("xiaoa wins.");    return 0;    }
45     if((a[1][1]==1&&a[2][2]==1&&a[3][3]==1)||(a[1][3]==1&&a[2][2]==1&&a[3][1]==1))
46     {    printf("xiaoa wins.");    return 0;    }
47     for(int i=1;i<=3;i++)
48         if(hang2[i]==3||lie2[i]==3)
49         {    printf("uim wins.");    return 0;    }
50     if((a[1][1]==0&&a[2][2]==0&&a[3][3]==0)||(a[1][3]==0&&a[2][2]==0&&a[3][1]==0))
51     {        printf("uim wins.");        return 0;    }
52     printf("drew.");
53     return 0;
54 }

View Code

T3P1319 压缩技术

https://www.luogu.org/problemnew/show/P1319

根据题意模拟即可

 1 #include<iostream>
 2 #include<cstdio>
 3 #include<cstring>
 4 #include<cmath>
 5 #define LL  long long
 6 using namespace std;
 7 const int MAXN=201;
 8 inline int read()
 9 {
10     char c=getchar();int flag=1,x=0;
11     while(c<'0'||c>'9')    {if(c=='-')    flag=-1;c=getchar();}
12     while(c>='0'&&c<='9')    x=(x*10+c-48),c=getchar();    return x*flag;
13 }
14 int n;
15 int main()
16 {
17     n=read();
18     int now=0;
19     int how=1;//zero
20     int p;
21     while(cin>>p)
22     {
23         for(int i=1;i<=p;i++)
24         {
25             if(how==1)    printf("0");
26             else         printf("1");
27             now++;
28             if(now==n)    printf("\n"),now=0;
29         }
30         if(how==1)    how=0;
31         else how=1;
32     }
33     return 0;
34 }

View Code

T4P2077 红绿灯

https://www.luogu.org/problemnew/show/P2077

模拟汽车的行走路线,注意在经过红绿灯的时候取模

 1 #include<iostream>
 2 #include<cstdio>
 3 #include<cstring>
 4 #include<cmath>
 5 #define LL  long long
 6 using namespace std;
 7 const int MAXN=200001;
 8 inline int read()
 9 {
10     char c=getchar();int flag=1,x=0;
11     while(c<'0'||c>'9')    {if(c=='-')    flag=-1;c=getchar();}
12     while(c>='0'&&c<='9')    x=(x*10+c-48),c=getchar();    return x*flag;
13 }
14 int n,m;
15 int dis[MAXN];
16 int green[MAXN];
17 int red[MAXN];
18 int get(int pos,int val)
19 {
20     int now=val%(green[pos]+red[pos]);
21     if(now<=green[pos])    return 0;
22     return red[pos]-(now-green[pos]);
23 }
24 int main()
25 {
26     n=read(),m=read();
27     for(int i=1;i<=n-1;i++)    dis[i]=read();
28     for(int i=1;i<=n;i++)    red[i]=read();
29     for(int i=1;i<=n;i++)    green[i]=read();
30     int now=m;
31     for(int i=1;i<=n;i++)
32     {
33         now=now+get(i,now);
34         printf("%d\n",now);
35         now+=dis[i];
36     }
37     return 0;
38 }

View Code

T5P2043 质因子分解

https://www.luogu.org/problemnew/show/P2043

枚举1-n,依次进行分解

 1 #include<iostream>
 2 #include<cstdio>
 3 #include<cstring>
 4 #include<cmath>
 5 #define LL  long long
 6 using namespace std;
 7 const LL MAXN=200001;
 8 inline LL read()
 9 {
10     char c=getchar();LL flag=1,x=0;
11     while(c<'0'||c>'9')    {if(c=='-')    flag=-1;c=getchar();}
12     while(c>='0'&&c<='9')    x=(x*10+c-48),c=getchar();    return x*flag;
13 }
14 LL n;
15 LL vis[MAXN];
16 LL prime[MAXN];
17 LL tot=0;
18 LL ans[MAXN];
19 int main()
20 {
21     n=read();
22     vis[1]=1;
23     for(LL i=1;i<=10000;i++)
24     {
25         if(vis[i]==0)
26         {
27             prime[++tot]=i;
28             for(LL j=i;j<=15000;j+=i)
29                 vis[j]=1;
30         }
31     }
32 //    for(LL i=1;i<=tot;i++)
33     //    cout<<prime[i]<<" ";
34     for(LL i=1;i<=n;i++)
35     {
36         LL p=i;
37         for(LL j=1;j<=tot;j++)
38             while(p%prime[j]==0&&p!=1)
39                 ans[j]++,p=p/prime[j];
40     }
41     for(LL i=1;i<=tot;i++)
42         if(ans[i]!=0)
43             printf("%lld %lld\n",prime[i],ans[i]);
44     return 0;
45 }

View Code

T6P1737 旷野大计算

https://www.luogu.org/problemnew/show/P1737

转载于:https://www.cnblogs.com/zwfymqz/p/7735029.html

2017.10.25水题大作战题解相关推荐

  1. 2017.10.25

    日期计算 时间限制:3000 ms  |  内存限制:65535 KB 难度:1 描述 如题,输入一个日期,格式如:2010 10 24 ,判断这一天是这一年中的第几天. 输入 第一行输入一个数N(0 ...

  2. 【leetcode刷题大作战】本周整理

    关键词:HashMap 母题--T205:同构字符串 class Solution {public boolean isIsomorphic(String s, String t) {if (s.le ...

  3. 2017.10.25 书柜的尺寸 失败总结

    这题只能想到第一步.. 首先题目要求的是最小化两个变量的关系,那就必须转化成一个变量的关系,化动为静 比如:枚举限制因素,枚举所有值,再或者就是贪心 一开始想到枚举限制因素,即枚举三个集合中高度最大的 ...

  4. 2017.10.25笔记3

    1.语法   <form method="get|post" action="数据向哪提交的地址">    //表单内容   </form&g ...

  5. 2017.10.25 打鼹鼠 思考记录

    挺直白的dp 离散的是移动的过程,因为经过一番移动一定是为了出现在某个地点 所以直接m^2枚举,类似lis的转移即可 码: #include<iostream> #include<c ...

  6. 22.10.25补卡 一堆cf水题

    被骂了, 写点水题泄泄愤 Problem - A - Codeforces 贪心, 排一下序, 每次选最大的, 选的同时记录一下已经拿了多少个硬币 /* ⣿⣿⣿⣿⣿⣿⡷⣯⢿⣿⣷⣻⢯⣿⡽⣻⢿⣿⣿⣿⣿⣿⣿ ...

  7. 下列不属于未来发展的计算机技术是,计算机系统结构自考2017年10月真题

    计算机系统结构自考2017年10月真题及答案解析 本试卷为选择题型,填空题,简答题,应用题等题型. 一.单项选择题在每小题列出的四个备选项中只有一个是符合题目要求的,请将其代码填写在题后的括号内.错选 ...

  8. SDUT Round #4 - 2018 新春大作战 官方题解(纯净版)

    比赛重现链接:2018新春大作战重现赛 出题人: axuhognbo:徐红博 xuanhuang:秦圣昭 IceCapriccio:王炜良 JiaoGuan:陈海星 A: 提交链接 出题人:xuanh ...

  9. SDUT Round #4 - 2018 新春大作战 官方题解(保留版)

    比赛重现链接:2018新春大作战重现赛 出题人: axuhognbo:徐红博 xuanhuang:秦圣昭 IceCapriccio:王炜良 JiaoGuan:陈海星 A: 提交链接 出题人:xuanh ...

最新文章

  1. 如何创建自己的ESLint配置包
  2. 【译】五个ES6功能,让你编写代码更容易
  3. QT-X11-3.1.2.tar.bz2的使用
  4. 你好a+b(非入门)
  5. 配置jdk1.7的环境变量
  6. myeclipse打开JSP电脑很卡,CPU使用率90%以上
  7. ISAKMP主模式分析二
  8. 联想台式计算机内置网卡,联想台式机有没有无线网卡
  9. 增加关键词密度不要堆积
  10. 什么是HTML? 看这一篇就够了(附带主流IDE推荐)
  11. uk码对照表_鞋码对照表_UK鞋码对照表
  12. 一个保护眼睛的小技巧
  13. Mysql内查询时报错,错误代码: 1146
  14. Windows11镜像下载及安装
  15. MySQL数据库代理技术
  16. 关于对《三只松鼠》网站的诊断报告
  17. 基于51单片机+DHT11温湿度+LCD1602显示
  18. IE11离线安装包ie离线升级ie11离线安装ie11补丁
  19. “扣扣保镖”一剑封喉,腾讯QQ溃不成军
  20. 论《金瓶梅》与项目管理中人际关系协调(转)

热门文章

  1. win10使用Composer-Setup安装Composer以及使用Composer安装Yii2最新版
  2. Gridview SummaryItem 格式化数字
  3. WebService的基本概念:java webservice,什么是webservice
  4. 字符与字符串操作——Windows via C/C++
  5. Redis在windows下的配置
  6. 直击3.15 安防行业如何维护消费者权益
  7. Node.js~在linux上的部署
  8. POJ1274 The Perfect Stall(二分图)
  9. StringBuffer与StringBuilder
  10. 解决Vmware中安装Ubuntu Server 14.04 分辨率无法全屏问题