补题解:

E:只会第四种解法;也只看懂了这一种。

PS:F[X+10^18]=F[X]+1;F[X]表示X的数字之和;

假设X,F[10^18+X]+F[10^18+X-1]+......F[10^18+1]=F[1]+.....+F[X]+X;

这个应该没问题所以有G[10^18+X]-G[10^18]=G[X]+X;

G[X]表示:1-X的数字和的总和;

根据G[10^X]=45*X*10^(X-1);所以G[10^18]=45*18*10^17;

所以G[10^18+X]-G[X]=(G[10^18]+X)%a;

然后就可以推出时X的大小,X=a-G[10^18]%a;

这样这题就完美解决;

 #include <stdio.h>
#include<iostream>
void solve(){
unsigned long long s = 100000000000000000ll;
__int64 p = s * ;
__int64 a;
scanf("%I64d",&a);
s = (s * ) % a;
s = (s * + ) % a;
a = a - s;
printf("%I64d %I64d\n", + a,p + a);
}
int main(){
solve();
return ;
}

D题:@狗哥有个好想法;

假如B>A;

那么对于一个数组最小的数X,如果能在B-X=PB找到他的匹配,那么不用再A中找到,

原因是假如X“嫁"给了A,在A中会有一个A-X=YA与之搭配。

但是PB就找不到”老婆“了,因为A-X<B-X,但是X已经是最小的,所以PB就无法对应了,

然后就是写法的问题了;

 #include<iostream>
#include<stdio.h>
#include<cmath>
#include<cstring>
#include<algorithm>
#include<iostream>
#include<map>
#include<string>
typedef long long ll;
using namespace std;
int ans[];
map<int,int>mp; int n,a,b;
int pa,pb; int main()
{
cin>>n>>a>>b;
for (int i=;i<=n;i++)
{
int x;
cin>>x;
mp[x]=i;
}
int pa=,pb=;
if (a>b) swap(a,b),swap(pa,pb); for (map<int,int>::iterator mi=mp.begin();mi!=mp.end();mi++)
{
int val=mi->first;
int pos=mi->second;
if (ans[pos]) continue;
if (mp.find(b-val)!=mp.end()&&ans[mp[b-val]]!=pa)
ans[pos]=ans[mp[b-val]]=pb;
else if (mp.find(a-val)!=mp.end()&&ans[mp[a-val]]!=pb)
ans[pos]=ans[mp[a-val]]=pa;
else
{
cout<<"NO"<<endl;
return ;
}
}
cout<<"YES"<<endl;
for (int i=;i<=n;i++) cout<<ans[i]-<<" ";
return ;
}

C:我分奇数偶数;

因为1*2*3*4=24;

6-5=1;

8-7=1;

10-9=1;

发现了什么,

奇数也可以类推;

1,2,3,4,5手动找一下;

7-6=1;

9-8=1;

然后就可以了

B,A基本照着模拟就可以了

Codeforces Round #268 (Div. 2)的更多相关文章

  1. Codeforces Round #268 (Div. 2) ABCD

    CF469 Codeforces Round #268 (Div. 2) http://codeforces.com/contest/469 开学了,时间少,水题就不写题解了,不水的题也不写这么详细了 ...

  2. Codeforces Round #268 (Div. 1) B. Two Sets 暴力

    B. Two Sets Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/468/problem/B ...

  3. Codeforces Round #268 (Div. 1) A. 24 Game 构造

    A. 24 Game Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/468/problem/A D ...

  4. 贪心+bfs 或者 并查集 Codeforces Round #268 (Div. 2) D

    http://codeforces.com/contest/469/problem/D 题目大意: 给你一个长度为n数组,给你两个集合A.B,再给你两个数字a和b.A集合中的每一个数字x都也能在a集合 ...

  5. Codeforces Round #268 (Div. 2) (被屠记)

    c被fst了................ 然后掉到600+.... 然后...估计得绿名了.. sad A.I Wanna Be the Guy 题意:让你判断1-n个数哪个数没有出现.. sb题 ...

  6. Codeforces Round #268 (Div. 1) 468D Tree(杜教题+树的重心+线段树+set)

    题目大意 给出一棵树,边上有权值,要求给出一个1到n的排列p,使得sigma d(i, pi)最大,且p的字典序尽量小. d(u, v)为树上两点u和v的距离 题解:一开始没看出来p需要每个数都不同, ...

  7. Codeforces Round #268 (Div. 2) D. Two Sets [stl - set + 暴力]

    8161957                 2014-10-10 06:12:37     njczy2010     D - Two Sets             GNU C++     A ...

  8. Codeforces Round #366 (Div. 2) ABC

    Codeforces Round #366 (Div. 2) A I hate that I love that I hate it水题 #I hate that I love that I hate ...

  9. Codeforces Round #354 (Div. 2) ABCD

    Codeforces Round #354 (Div. 2) Problems     # Name     A Nicholas and Permutation standard input/out ...

随机推荐

  1. 浅谈DEs,AES

    1. AES加密,相对比较简单,之前已经配置好工具类. package com.bbguoxue.poetry.util; import java.security.SecureRandom; imp ...

  2. C# 委托简单使用方法

    using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.T ...

  3. JavaScript高级程序设计之基本包装类型

    为便于操作基本类型值,ECMAScript提供了3个特殊的引用类型:Boolean, Number 和 String // 字符串怎么会有方法呢 var str1 = "some text& ...

  4. Go append方法

    append用来将元素添加到切片末尾并返回结果.看代码: package main import "fmt" func main() { x := [],,} y := [],,} ...

  5. ASP.NET分页

    [代码][C#]代码 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 ...

  6. Beyond Compare 4

    Beyond Compare是一款不可多得的专业级的文件夹和文件对比工具.使用他可以很方便的对比出两个文件夹或者文件的不同之处.并把相差的每一个字节用颜色加以表示,查看方便.并且支持多种规则对比.

  7. apache maven

    aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAj0AAAGXCAYAAABY/uEUAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjw ...

  8. P3400: [Usaco2009 Mar]Cow Frisbee Team 奶牛沙盘队

    太水了,背包DP. (转载请注明出处:http://www.cnblogs.com/Kalenda/) ; var n,f,i,j,ans,t,tt:longint; q:array[..] of l ...

  9. C++ STL中Map的按Key排序和按Value排序

    map是用来存放<key, value>键值对的数据结构,可以很方便快速的根据key查到相应的value.假如存储学生和其成绩(假定不存在重名,当然可以对重名加以区 分),我们用map来进 ...

  10. 20145120 《Java程序设计》实验三实验报告

    20145120 <Java程序设计>实验三实验报告 实验名称:敏捷开发与XP实践 实验目的与要求: XP基础 XP核心实践 相关工具 (一)敏捷开发与XP 极限编程(eXtreme Pr ...