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. String、StringBuffer与StringBuilder之间区别 (转载)
  2. NeurIPS 2020 接收率创史低,千篇论文被摘要拒稿,官方:错误率只有 6%
  3. 程序员新手第一个python web开发框架
  4. css媒体查询移动优先和pc优先
  5. tomcat 目录配置 appBase和docBase 简介
  6. 右键删除选中的行总提示rowIndex
  7. 把iconfront的资源放cdn访问_详解mpvue小程序中怎么引入iconfont字体图标
  8. python网络框架生产环境_配置Django框架为生产环境的注意事项(DEBUG=False)
  9. pyqtsignal()作用
  10. 2021年高压电工考试技巧及高压电工复审模拟考试
  11. rca接口_新手小白必读 1分钟看懂同轴和光纤音频接口
  12. mysql 夏令时_MySQL日期时间字段和夏时制-如何引用“额外”小时?
  13. 写在虚拟机闪退,red hat挂了之后
  14. docker使用和搭建
  15. qt 打印 刻度尺 曲线 复杂图像
  16. htmlmo标签,index.html
  17. IDA创建结构体方法
  18. 深度学习中的循环神经网络LSTM详解
  19. php漏洞 乌云,GitHub - grt1st/wooyun_search: 乌云公开漏洞、知识库搜索 search from wooyun.org...
  20. C# 项目如何修改项目名称

热门文章

  1. Spring中的动态代理
  2. set_error_handler自定义错误处理
  3. Interesting Finds: 2008.03.24
  4. Ubuntu下selenium+Chrome的安装使用
  5. tfs文件系统之NS配置管理
  6. 通过rhel7的kvm虚拟机实现3节点Postgres-XL(包括gtm standby)
  7. PHP中封装mysql数据库链接(简单版)
  8. android js调试
  9. 解决Vmware中安装Ubuntu Server 14.04 分辨率无法全屏问题
  10. 【乡音】海安话四级考试