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

A题AC代码:

 #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <malloc.h>
#include <stdbool.h>
#include <ctype.h> typedef long long ll; int main()
{
ll n, k, i, j, ans;
while( ~scanf( "%I64d%I64d", &n, &k ) )
{
printf( "%I64d\n", ( k + n - ) / n );
}
return ;
}

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

B题AC代码:

 #include <iostream>
#include <cstring>
#include <cstdio> typedef unsigned long long ULL;
typedef const int cint;
typedef long long LL;
using namespace std; int q;
LL n,m,k;
template< typename Q >
void inin(Q &); int main()
{
inin(q);
while( q -- )
{
inin(n);
inin(m);
inin(k);
if( n > m )
swap( n, m );
if( k < m )
printf( "-1" );
else
{
if( n == m )
{
if( ( k-n ) & )
printf( "%I64d", k - );
else
printf( "%I64d", k );
}
else
{
LL temp = m - n;
if( temp & )
printf( "%I64d", k - );
else
{
if( ( k - m ) & )
printf( "%I64d", k - );
else
printf( "%I64d", k );
}
}
}
printf( "\n" );
}
return ;
} template< typename Q >
void inin( Q &x )
{
x=;
int f=;
char ch;
scanf( "%c", &ch );
while( ch < '' || ch > '' )
{
if( ch == '-' )
f = ;
scanf( "%c", &ch );
}
while( ch >= '' && ch <= '' )
{
x = x* + ch - '';
scanf( "%c", &ch );
}
x = f?-x:x;
}

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

C题AC代码:

 #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <malloc.h>
#include <stdbool.h>
#include <ctype.h> typedef long long ll; ll Arr[][];
int dig[];
ll dp( int, int, int );
ll calc(ll); int main()
{
memset( Arr, -, sizeof(Arr) );
int i, T=;
ll L,R;
while( ~scanf( "%d", &T ) )
{
for ( i = ; i <= T; i ++ )
{
scanf( "%I64d%I64d", &L, &R );
L--;
printf( "%I64d\n", calc(R) - calc(L) );
}
}
return ;
} ll dp( int len, int res, int lim )
{
if ( res > )
return ;
if ( len == )
return ;
if ( !lim && Arr[len][res] > )
return Arr[len][res];
ll ret = ;
int up = ;
if (lim)
up=dig[len];
int i;
for ( i = ; i <= up; i ++ )
ret += dp( len-, res+(i>), lim && ( i == up ) );
if (!lim) Arr[len][res]=ret;
return ret;
} ll calc(ll x)
{
int _sum = ;
while (x)
{
dig[ ++ _sum ] = x % ;
x /= ;
}
return dp( _sum, , );
}

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

Educational Codeforces Round 50 (Rated for Div. 2)的A、B、C三题AC代码的更多相关文章

  1. Educational Codeforces Round 50 (Rated for Div. 2) F - Relatively Prime Powers(数学+容斥)

    题目链接:http://codeforces.com/contest/1036/problem/F 题意: 题解:求在[2,n]中,x != a ^ b(b >= 2 即为gcd)的个数,那么实 ...

  2. Educational Codeforces Round 50 (Rated for Div. 2) C. Classy Numbers

    C. Classy Numbers 题目链接:https://codeforces.com/contest/1036/problem/C 题意: 给出n个询问,每个询问给出Li,Ri,问在这个闭区间中 ...

  3. Educational Codeforces Round 50 (Rated for Div. 2)F. Relatively Prime Powers

    实际上就是求在[2,n]中,x != a^b的个数,那么实际上就是要求x=a^b的个数,然后用总数减掉就好了. 直接开方求和显然会有重复的数.容斥搞一下,但实际上是要用到莫比乌斯函数的,另外要注意减掉 ...

  4. Educational Codeforces Round 50 (Rated for Div. 2) E. Covered Points

    注释上都有解析了,就不写了吧,去重的问题就用set解决,并且呢第i个线段最多和其他线段产生i-1个交点,n^2logn. #include <cmath> #include <cst ...

  5. Educational Codeforces Round 76 (Rated for Div. 2) A. Two Rival Students 水题

    A. Two Rival Students There are

  6. Educational Codeforces Round 94 (Rated for Div. 2) A. String Similarity (构造水题)

    题意:给你一个长度为\(2*n-1\)的字符串\(s\),让你构造一个长度为\(n\)的字符串,使得构造的字符串中有相同位置的字符等于\(s[1..n],s[2..n+1],...,s[n,2n-1] ...

  7. Codeforces Educational Codeforces Round 44 (Rated for Div. 2) F. Isomorphic Strings

    Codeforces Educational Codeforces Round 44 (Rated for Div. 2) F. Isomorphic Strings 题目连接: http://cod ...

  8. Educational Codeforces Round 63 (Rated for Div. 2) 题解

    Educational Codeforces Round 63 (Rated for Div. 2)题解 题目链接 A. Reverse a Substring 给出一个字符串,现在可以对这个字符串进 ...

  9. Educational Codeforces Round 60 (Rated for Div. 2) - C. Magic Ship

    Problem   Educational Codeforces Round 60 (Rated for Div. 2) - C. Magic Ship Time Limit: 2000 mSec P ...

随机推荐

  1. .Net开发人员必备工具下载

    .Net开发人员必备工具下载   本人亲测下载地址: Win8.1破解工具下载: http://pan.baidu.com/s/1eQf2UiQ 可激活版本 Windows Vista Busines ...

  2. 【bzoj2084】[Poi2010]Antisymmetry

    2084: [Poi2010]Antisymmetry Time Limit: 10 Sec  Memory Limit: 259 MBSubmit: 1205  Solved: 756[Submit ...

  3. Educational Codeforces Round 46 (Rated for Div. 2) E. We Need More Bosses

    Bryce1010模板 http://codeforces.com/contest/1000/problem/E 题意: 给一个无向图,求图的最长直径. 思路:对无向图缩点以后,求图的最长直径 #in ...

  4. Substring CodeForces - 919D

    http://codeforces.com/problemset/problem/919/D 就是先判环,如果有环就-1,否则对每个字母分开跑一下dp 错误记录: 1.有向图判环,自环一定要特判!(不 ...

  5. 状态压缩DP SRM 667 Div1 OrderOfOperations 250

    Problem Statement      Cat Noku has just finished writing his first computer program. Noku's compute ...

  6. rhel6.5--http练习

    包名 简介 httpd-2.2.15-29.el6_4.x86_64.rpm         http服务的主程序包 httpd-devel-2.2.15-29.el6_4.x86_64.rpm ap ...

  7. iOS 项目代码组织

    参考了很多系列,发现老外们都比较喜欢 group by type,这两个还不错: http://akosma.com/2009/07/28/code-organization-in-xcode-pro ...

  8. Jquary基础

    基本知识: 就是一个JS函数包 选择器:基本选择器: 基本:ID选择器 “#” , Class选择器 “.”,标签选择器 “标签名” 组合:并列用“,”隔开   后代用空格隔开 过滤选择器:基本过滤: ...

  9. List的深度copy和浅度拷贝

    List<Student> list= Arrays.asList( new Student("Fndroid", 22, Student.Sax.MALE, 180) ...

  10. poj2441 Arrange the Bulls

    思路: 状态压缩dp.需要一点优化,否则容易超时. 实现: #include <cstdio> #include <vector> #include <cstring&g ...