A题链接:https://codeforces.com/contest/1036/problem/A

A题AC代码:

 1 #include <stdio.h>
 2 #include <stdlib.h>
 3 #include <string.h>
 4 #include <math.h>
 5 #include <malloc.h>
 6 #include <stdbool.h>
 7 #include <ctype.h>
 8
 9 typedef long long ll;
10
11
12 int main()
13 {
14     ll n, k, i, j, ans;
15     while( ~scanf( "%I64d%I64d", &n, &k ) )
16     {
17         printf( "%I64d\n", ( k + n - 1 ) / n );
18     }
19     return 0;
20 }

B题链接:https://codeforces.com/contest/1036/problem/B

B题AC代码:

 1 #include <iostream>
 2 #include <cstring>
 3 #include <cstdio>
 4
 5 typedef unsigned long long ULL;
 6 typedef const int cint;
 7 typedef long long LL;
 8 using namespace std;
 9
10
11 int q;
12 LL n,m,k;
13 template< typename Q >
14 void inin(Q &);
15
16 int main()
17 {
18     inin(q);
19     while( q -- )
20     {
21         inin(n);
22         inin(m);
23         inin(k);
24         if( n > m )
25             swap( n, m );
26         if( k < m )
27             printf( "-1" );
28         else
29         {
30             if( n == m )
31             {
32                 if( ( k-n ) & 1 )
33                     printf( "%I64d", k - 2 );
34                 else
35                     printf( "%I64d", k );
36             }
37             else
38             {
39                 LL temp = m - n;
40                 if( temp & 1 )
41                     printf( "%I64d", k - 1 );
42                 else
43                 {
44                     if( ( k - m ) & 1 )
45                         printf( "%I64d", k - 2 );
46                     else
47                         printf( "%I64d", k );
48                 }
49             }
50         }
51         printf( "\n" );
52     }
53     return 0;
54 }
55
56 template< typename Q >
57 void inin( Q &x )
58 {
59     x=0;
60     int f=0;
61     char ch;
62     scanf( "%c", &ch );
63     while( ch < '0' || ch > '9' )
64     {
65         if( ch == '-' )
66             f = 1;
67         scanf( "%c", &ch );
68     }
69     while( ch >= '0' && ch <= '9' )
70     {
71         x = x*10 + ch - '0';
72         scanf( "%c", &ch );
73     }
74     x = f?-x:x;
75 }

C题链接:https://codeforces.com/contest/1036/problem/C

C题AC代码:

 1 #include <stdio.h>
 2 #include <stdlib.h>
 3 #include <string.h>
 4 #include <math.h>
 5 #include <malloc.h>
 6 #include <stdbool.h>
 7 #include <ctype.h>
 8
 9 typedef long long ll;
10
11 ll Arr[20][4];
12 int dig[20];
13 ll dp( int, int, int );
14 ll calc(ll);
15
16 int main()
17 {
18     memset( Arr, -1, sizeof(Arr) );
19     int i, T=0;
20     ll L,R;
21     while( ~scanf( "%d", &T ) )
22     {
23         for ( i = 1; i <= T; i ++ )
24         {
25             scanf( "%I64d%I64d", &L, &R );
26             L--;
27             printf( "%I64d\n", calc(R) - calc(L) );
28         }
29     }
30     return 0;
31 }
32
33 ll dp( int len, int res, int lim )
34 {
35     if ( res > 3 )
36         return 0;
37     if ( len == 0 )
38         return 1;
39     if ( !lim && Arr[len][res] > 0 )
40         return Arr[len][res];
41     ll ret = 0;
42     int up = 9;
43     if (lim)
44         up=dig[len];
45     int i;
46     for ( i = 0; i <= up; i ++ )
47         ret += dp( len-1, res+(i>0), lim && ( i == up ) );
48     if (!lim) Arr[len][res]=ret;
49     return ret;
50 }
51
52 ll calc(ll x)
53 {
54     int _sum = 0;
55     while (x)
56     {
57         dig[ ++ _sum ] = x % 10;
58         x /= 10;
59     }
60     return dp( _sum, 0, 1 );
61 }

全部测过样例再提交,另外,本蒟蒻还从未做过D……

转载于:https://www.cnblogs.com/25th-engineer/p/9649460.html

Educational Codeforces Round 50 (Rated for Div. 2)的A、B、C三题AC代码相关推荐

  1. Educational Codeforces Round 90 (Rated for Div. 2)(A, B, C, D, E)

    Educational Codeforces Round 90 (Rated for Div. 2) Donut Shops 思路 分三种情况: a==c/ba == c / ba==c/b这个时候两 ...

  2. Educational Codeforces Round 138 (Rated for Div. 2) D

    Educational Codeforces Round 138 (Rated for Div. 2) D. Counting Arrays 题意 给定长度为nnn的数组aaa,若gcd(ai,i)= ...

  3. Educational Codeforces Round 114 (Rated for Div. 2) (A ~ F)全题解

    整理的算法模板合集: ACM模板 点我看算法全家桶系列!!! 实际上是一个全新的精炼模板整合计划 Educational Codeforces Round 114 (Rated for Div. 2) ...

  4. Educational Codeforces Round 106 (Rated for Div. 2)(A ~ E)题解(每日训练 Day.16 )

    整理的算法模板合集: ACM模板 点我看算法全家桶系列!!! 实际上是一个全新的精炼模板整合计划 目录 Educational Codeforces Round 106 (Rated for Div. ...

  5. Educational Codeforces Round 37 (Rated for Div. 2) 1

    Educational Codeforces Round 37 (Rated for Div. 2) A.Water The Garden 题意:Max想给花园浇水.花园可被视为长度为n的花园床,花园 ...

  6. Educational Codeforces Round 89 (Rated for Div. 2)(A, B, C, D)

    Educational Codeforces Round 89 (Rated for Div. 2) A. Shovels and Swords 思路 题意非常简单,就是得到最多的物品嘛,我们假定a, ...

  7. Educational Codeforces Round 114 (Rated for Div. 2) D. The Strongest Build 暴力 + bfs

    传送门 文章目录 题意: 思路: 题意: 你有nnn个装备槽,每个槽里面有cic_ici​个力量加成,对于每个槽只能选一个力量加成,现在给你mmm个力量组合[b1,b2,...,bn][b_1,b_2 ...

  8. Educational Codeforces Round 72 (Rated for Div. 2) D. Coloring Edges dfs树/拓扑找环

    传送门 文章目录 题意: 思路: 题意: 给你一张图,你需要给这个图的边染色,保证如果有环那么这个环内边的颜色不全相同,输出染色方案和用的颜色个数. n,m≤5e3n,m\le5e3n,m≤5e3 思 ...

  9. Educational Codeforces Round 111 (Rated for Div. 2) D. Excellent Arrays 组合数学

    传送门 文章目录 题意: 思路: 题意: 给你一个数组aia_iai​,定义一个数组是好的当且仅当对于所有iii都有ai!=ia_i!=iai​!=i.定义f(a)f(a)f(a)表示数组aaa中i& ...

最新文章

  1. 机器学习笔记七:损失函数与风险函数
  2. 安卓手电筒_将价值10美元的手电筒砍入超高亮高级灯中
  3. IE8兼容问题总结---trim()方法
  4. 使用流进行通讯的一种可能犯的错误 (InputStream + OutputStream)
  5. 大写的“极简” H3C MSG360系列网关
  6. 用户是如何浏览你的网站的
  7. ubuntu tftp 端口 NFS端口固定与防火墙
  8. 一文搞懂如何高效学习与进阶NLP or CV!
  9. spring aop的简单使用
  10. win10恢复经典开始菜单_打造个性化开始菜单,Win10 开始菜单任务栏美化增强软件...
  11. Unity5.3 使用Awesomium插件内嵌网页
  12. 初学C语言,可能需要的软件及下载方式
  13. openstack配额
  14. Linux介绍及安装过程 常用的命令 对目录或文件的增删改查 压缩和解压缩 用户和权限 shell/shellScript linux的一些其他命令
  15. 网站页面上标签页小图标的添加方式
  16. 啊哈添柴挑战Java1008. 输入两个整数,倒序输出
  17. 小米将推出新款自研芯片
  18. 当SWOOLE遇上PROTOCOL
  19. 用迭代法求某数a的平方根
  20. JavaScript 高级编程(二)

热门文章

  1. 串—KMP算法(详细)
  2. python连接mongo_Python连接MongoDB操作
  3. html canvas抽奖,HTML5 Canvas圆盘抽奖应用(适用于Vue项目)
  4. android java 给控件设置style,在Android Lollipop for Material Design中为SwitchCompat按钮设置样式/着色...
  5. 主题图片_临床医学院“树树皆秋色,山山唯落晖”主题图片征集活动
  6. go爬取json_Python爬取百度文库学习
  7. 某一列高度变化_高度近视,老了后会瞎吗?
  8. yandex注册验证码怎么填_注册资本到底怎么填?
  9. 开发日记-20190815 关键词 读书笔记《Linux 系统管理技术手册(第二版)》DAY 23
  10. 简单多元线性回归(梯度下降算法与矩阵法)