补题解:

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. DELPHI XE5 FOR ANDROID 模仿驾考宝典 TMEMO 控件随着字数增多自动增高

    在一个安卓需求中,需要模仿驾考宝典的详解部分.琢磨了好几天.终于搞定: MemoAns.Height:=10;//MEMO控件赋初始高度值 MemoAns.Lines.Clear; MemoAns.W ...

  2. 网页绘制图表 Google Charts with JavaScript #2 ....与ASP.NET网页结合 (ClientScriptManager.RegisterStartupScript 方法)

    此为文章备份,原文出处(我的网站) 网页绘制图表 Google Charts with JavaScript #2 ....与ASP.NET网页结合 (ClientScriptManager.Regi ...

  3. ED/EP系列2《文件结构》

    电子存折/电子钱包应用是为持卡人进行金融交易而设计的一种应用.对于一张金融 IC 卡来说,它可以同时支持电子存折和电子钱包两种应用,也可以只支持其中的一种.卡片上两种应用的存在情况可以由应用类型标识( ...

  4. oracle 表空间和表 read only迁移后不再read only

    DB :  11.2.0.3.0 1.将tablespace read only , 不允许再对表进行update.insert操作,测试dmp到另一个用户.表空间后是否可以update.insert ...

  5. hdu 1718 Rank

    题目连接 http://acm.hdu.edu.cn/showproblem.php?pid=1718 Rank Description Jackson wants to know his rank ...

  6. 常见css的兼容问题

    链接的虚线框问题 <!-- html --> <a class="noDashedBox" href="#"><img src=& ...

  7. 记录一下mvc发布

    让别人也可以访问你电脑上的ASP.NET MVC创建的网站 http://www.cnblogs.com/laoqi/p/4169184.html

  8. 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 ...

  9. Status Bar in iOS7

    This is a very important change in iOS 7: the status bar is no longer a separate bar. It’s now somet ...

  10. UIPickerView swift

    // // ViewController.swift // UILabelTest // // Created by mac on 15/6/23. // Copyright (c) 2015年 fa ...