题意:给定n与m,要求构造两个长度不超过2230的数字x,y使得x,y各自的数位和>=n,x+y的数位和<=n 思路: #include<cstdio> #include<cstring> #include<string> #include<cmath> #include<iostream> #include<algorithm> #include<map> #include<set> #inclu…
[链接] 我是链接,点我呀:) [题意] 在这里输入题意 [题解] 让a+b的和为100000000...0这样的形式就好了 这样s(a+b)=1<=m就肯定成立了(m>=1) 然后至于s(a)>=n和s(b)>=n 随便写个a=1111111...112然后b=8888888...888这样就好 [代码] #include <bits/stdc++.h> #define LL long long #define rep1(i,a,b) for (int i = a;i…
A. Find Square 找到对角线的两个点的坐标,这道题就迎刃而解了. inline void work(int n) { int m; cin >> m; memset(str, 0, sizeof(str)); rep(i,1,n) { scanf("%s", str+1); rep(j,1,m) a[i][j] = (str[j] == 'B' ? 1 : 0); } int lx = 0, ly = 0, rx = 0, ry = 0; for (int i…
AIM Tech Round 5 (codeforces上题目编号是1028)(A-E) ---完全被这次比赛打击,自己真的很渣--- 战况 依旧3题选手 被构造题坑得好惨 稍稍涨了rating,希望下次比赛好好准备进入蓝名,就可以被div1虐了 题目看题解也很难懂呀 A. Find Square 水题,找出矩形得中心,可以略过 B. Unnatural Conditions 题意: s(A)代表数字A各个数位之和即s(1234)=1+2+3+4=10 给出 m,n,需要求出满足条件A,B:s(…
B.Unnatural Conditions 题目链接 : http://codeforces.com/contest/1028/problem/B #include<iostream> #include<cstdio> #include<algorithm> #include<cmath> #define lson x<<1 #define rson (x<<1)|1 using namespace std; #define max…
系列导航 (一)词法分析介绍 (二)输入缓冲和代码定位 (三)正则表达式 (四)构造 NFA (五)转换 DFA (六)构造词法分析器 (七)总结 现在最核心的 DFA 已经成功构造出来了,最后一步就是根据 DFA 得到完整的词法分析器. 由于目前还不能像 Flex 那样支持词法定义文件,所以仍然需要在程序中定义规则,而且也不能非常灵活的自定义词法分析器,不过基本的东西完全够用了. 一.词法规则的定义 词法分析器用到的所有规则都在 Grammar<T> 类中定义,这里的泛型参数 T 表示词法分…
C. K-special Tables 题目连接: http://www.codeforces.com/contest/625/problem/C Description People do many crazy things to stand out in a crowd. Some of them dance, some learn by heart rules of Russian language, some try to become an outstanding competitiv…
C. The Closest Pair Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/312/problem/C Description Currently Tiny is learning Computational Geometry. When trying to solve a problem called "The Closest Pair Of Points In The Plane…
A. Black-and-White Cube time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output You are given a cube of size k × k × k, which consists of unit cubes. Two unit cubes are considered neighbouring, if…
当我们遇到多个构造器參数的时候可能会想到用构件器,代码例如以下: /** * 构建器 * @author 阳光小强 * */ public class Lunch { private String cake; private String meat; private String milk; private String drink; public Lunch(){ this(null); } public Lunch(String meat){ this(null, meat, null);…