A题

分析:注意两个点之间的倍数差,若为偶数则为YES,否则为NO

 #include "iostream"
#include "cstdio"
#include "cstring"
#include "string"
#include "cmath"
using namespace std;
int main()
{
int x1,y1,x2,y2;
cin>>x1>>y1>>x2>>y2;
int x,y;
cin>>x>>y;
int cnt1=x2-x1;
int cnt2=y2-y1;
int flag=;
if(cnt1%x){
flag=;
}
if(cnt2%y){
flag=;
}
if(abs(abs(cnt1/x)-abs(cnt2/y))%){
flag=;
}
if(!flag){
cout<<"YES"<<endl;
}else{
cout<<"NO"<<endl;
}
}

B题

分析:先看只用第一个数是否满足情况,如果不行在加入第二个数,不行在加入第三个数,如此分别统计三种情况即可

 #include "iostream"
#include "cstdio"
#include "cstring"
#include "string"
#include "algorithm"
#include "set"
#include "vector"
using namespace std;
const int maxn=+;
long long a[maxn];
int n;
long long solve3(long long sum){
return (sum*(sum-)*(sum-)/);
}
long long solve2(long long sum){
return (sum*(sum-)/);
}
int main()
{
cin>>n;
for(int i=;i<n;i++)
cin>>a[i];
sort(a,a+n);
set<long long>h;
for(int i=;i<n;i++){
h.insert(a[i]);
}
set<long long>::iterator it;
vector<long long>q;
for(it=h.begin();it!=h.end();it++){
q.push_back(*it);
}
long long cnt1=,cnt2=,cnt3=;
for(int i=;i<n;i++){
if(a[i]==q[]){
cnt1++;
}else if(a[i]==q[]){
cnt2++;
}else if(a[i]==q[]){
cnt3++;
}
}
if(cnt1>=){
cout<<solve3(cnt1)<<endl;
}else if(cnt1==){
cout<<cnt2<<endl;
}else{
if(cnt2>=){
cout<<solve2(cnt2)<<endl;
}else{
cout<<cnt3<<endl;
}
}
return ;
}

C题

分析:因为两个数的差值最大不会超过18*9=162,所以直接暴力即可

 #include "iostream"
#include "cstdio"
#include "cstring"
using namespace std;
long long a,b;
long long solve(long long num){
long long ans=;
while(num){
long long mod=num%;
ans+=mod;
num/=;
}
return ans;
}
int main()
{
cin>>b>>a;
long long sum=b-a;
if(sum<=){
cout<<""<<endl;
return ;
}
long long cnt=;
if(b-a<=){
for(long long i=a;i<=b;i++){
long long tt=i;
//cout<<b-solve(tt)<<endl;
if((i-solve(tt))>=a)
cnt++;
}
cout<<cnt<<endl;
}else{
for(long long i=a;i<=a+;i++){
long long yy=i;
if((i-solve(yy))<a)
cnt++;
}
cout<<sum-cnt+<<endl;
}
return ;
}

Educational Codeforces Round 23的更多相关文章

  1. Educational Codeforces Round 23 E. Choosing The Commander trie数

    E. Choosing The Commander time limit per test 2 seconds memory limit per test 256 megabytes input st ...

  2. Educational Codeforces Round 23.C

    C. Really Big Numbers time limit per test 1 second memory limit per test 256 megabytes input standar ...

  3. Educational Codeforces Round 23 B. Makes And The Product

    B. Makes And The Product time limit per test 2 seconds memory limit per test 256 megabytes input sta ...

  4. Educational Codeforces Round 23 F. MEX Queries 离散化+线段树

    F. MEX Queries time limit per test 2 seconds memory limit per test 256 megabytes input standard inpu ...

  5. Educational Codeforces Round 23 D. Imbalanced Array 单调栈

    D. Imbalanced Array time limit per test 2 seconds memory limit per test 256 megabytes input standard ...

  6. Educational Codeforces Round 23 C. Really Big Numbers 暴力

    C. Really Big Numbers time limit per test 1 second memory limit per test 256 megabytes input standar ...

  7. Educational Codeforces Round 23 补题小结

    昨晚听说有教做人场,去补了下玩. 大概我的水平能做个5/6的样子? (不会二进制Trie啊,我真菜) A. 傻逼题.大概可以看成向量加法,判断下就好了. #include<iostream> ...

  8. Educational Codeforces Round 23 A-F 补题

    A Treasure Hunt 注意负数和0的特殊处理.. 水题.. 然而又被Hack了 吗的智障 #include<bits/stdc++.h> using namespace std; ...

  9. Educational Codeforces Round 40千名记

    人生第二场codeforces.然而遇上了Education场这种东西 Educational Codeforces Round 40 下午先在家里睡了波觉,起来离开场还有10分钟. 但是突然想起来还 ...

随机推荐

  1. BOJ 2773 第K个与m互质的数

    算法是关键,得出1-m内的互质数,然后类推计算即可.下面有详细说明. #include<iostream> #include<cstring> using namespace ...

  2. Java_AOP原理

    AOP : 面向切面编程 在程序设计中,我们需要满足高耦合低内聚,所以编程需满足六大原则,一个法则. AOP面向切面编程正是为了满足这些原则的一种编程思想. 一.装饰者模式: 当我们需要给对象增加功能 ...

  3. [Inside HotSpot] Serial垃圾回收器 (二) Minor GC

    Serial垃圾回收器Minor GC 1. DefNewGeneration垃圾回收 新生代使用复制算法做垃圾回收,比老年代的标记-压缩简单很多,所有回收代码都位于DefNewGeneration: ...

  4. linux下eth0 lo wlan0

    参考:http://www.cnblogs.com/see7di/archive/2011/06/17/2239722.html 内容如下: 理解linux下的 eth0,eth1,eth2,lo 网 ...

  5. luogu P2659 美丽的序列

    题目背景 GD是一个热衷于寻求美好事物的人,一天他拿到了一个美丽的序列. 题目描述 为了研究这个序列的美丽程度,GD定义了一个序列的“美丽度”和“美丽系数”:对于这个序列的任意一个区间[l,r],这个 ...

  6. IntelliJ IDEA配置Tomcat/Jetty运行Web项目

    一.使用Maven的POM引入插件的形式: 这种方式只需在POM中引入Tomcat/Jetty的插件即可运行.参考:http://www.cnblogs.com/EasonJim/p/6687272. ...

  7. 一道题目- Find the smallest range that includes at least one number from each of the k lists

    You have k lists of sorted integers. Find the smallest range that includes at least one number from ...

  8. PHP将当前目录列出来

    $d=dir("."); echo $d->path; while(false !== ($e = $d->read())) { echo "<a hr ...

  9. Qt linux文件同步写入

    因为linux 系统机制问题,文件的创建和写入并不会直接写入硬盘.而是先写入缓存,当系统要关闭或须要时才写入硬盘.为防止突然掉电,应将缓存中的文件及时同步到硬盘上去. linux 下的sync 命令具 ...

  10. 我对hibernate和mybatis框架的比較

    系统在选择操作数据库的框架上面,究竟是选择hibernate,还是mybatis. 首先说下两者的原理,假设你要关联几张表做查询,查出20条记录: 1.假设是mybatis SELECT *   FR ...