AtCoder Regular Contest 091
数学场,做到怀疑人生系列
C - Flip,Flip, and Flip......
Time limit : 2sec / Memory limit : 256MB
Score : 300 points
Problem Statement
There is a grid with infinitely many rows and columns. In this grid, there is a rectangular region with consecutive N rows and M columns, and a card is placed in each square in this region. The front and back sides of these cards can be distinguished, and initially every card faces up.
We will perform the following operation once for each square contains a card:
- For each of the following nine squares, flip the card in it if it exists: the target square itself and the eight squares that shares a corner or a side with the target square.
It can be proved that, whether each card faces up or down after all the operations does not depend on the order the operations are performed. Find the number of cards that face down after all the operations.
Constraints
- 1≤N,M≤109
- All input values are integers.
Input
Input is given from Standard Input in the following format:
N M
Output
Print the number of cards that face down after all the operations.
Sample Input 1
2 2
Sample Output 1
0
We will flip every card in any of the four operations. Thus, after all the operations, all cards face up.
Sample Input 2
1 7
Sample Output 2
5
After all the operations, all cards except at both ends face down.
Sample Input 3
314 1592
Sample Output 3
496080
这个可以找规律,314×5×k的末尾是0 ,然后不断找下去,竟然是这个数-2相乘
#include<bits/stdc++.h>
using namespace std;
long long a,b;
int main(){
cin>>a>>b;
cout<<abs((a-)*(b-));
}
D - Remainder Reminder
Time limit : 2sec / Memory limit : 256MB
Score : 400 points
Problem Statement
Takahashi had a pair of two positive integers not exceeding N, (a,b), which he has forgotten. He remembers that the remainder of a divided by b was greater than or equal to K. Find the number of possible pairs that he may have had.
Constraints
- 1≤N≤105
- 0≤K≤N−1
- All input values are integers.
Input
Input is given from Standard Input in the following format:
N K
Output
Print the number of possible pairs that he may have had.
Sample Input 1
5 2
Sample Output 1
7
There are seven possible pairs: (2,3),(5,3),(2,4),(3,4),(2,5),(3,5) and (4,5).
Sample Input 2
10 0
Sample Output 2
100
Sample Input 3
31415 9265
Sample Output 3
287927211
这个题目骚啊,去暴力统计每个值对应的方案
#include<bits/stdc++.h>
using namespace std;
int main()
{
int n,k;
cin>>n>>k;
long long ans=;
for(int i=k+; i<=n; i++)
ans+=(n/i)*1LL*(i-k)+max(n%i-k+,)-!k;
cout<<ans;
}
AtCoder Regular Contest 091的更多相关文章
- AtCoder Regular Contest 091&092
091E(构造) 题意: 给出n,a,b.你需要构造出一个长度为n的n的排列,其中最长上升子序列的长度为a,最长下降子序列的长度为b. n,a,,b<=3e5 分析: 我们可以构造出这样的数列, ...
- AtCoder Regular Contest 061
AtCoder Regular Contest 061 C.Many Formulas 题意 给长度不超过\(10\)且由\(0\)到\(9\)数字组成的串S. 可以在两数字间放\(+\)号. 求所有 ...
- AtCoder Regular Contest 094 (ARC094) CDE题解
原文链接http://www.cnblogs.com/zhouzhendong/p/8735114.html $AtCoder\ Regular\ Contest\ 094(ARC094)\ CDE$ ...
- AtCoder Regular Contest 092
AtCoder Regular Contest 092 C - 2D Plane 2N Points 题意: 二维平面上给了\(2N\)个点,其中\(N\)个是\(A\)类点,\(N\)个是\(B\) ...
- AtCoder Regular Contest 093
AtCoder Regular Contest 093 C - Traveling Plan 题意: 给定n个点,求出删去i号点时,按顺序从起点到一号点走到n号点最后回到起点所走的路程是多少. \(n ...
- AtCoder Regular Contest 094
AtCoder Regular Contest 094 C - Same Integers 题意: 给定\(a,b,c\)三个数,可以进行两个操作:1.把一个数+2:2.把任意两个数+1.求最少需要几 ...
- AtCoder Regular Contest 095
AtCoder Regular Contest 095 C - Many Medians 题意: 给出n个数,求出去掉第i个数之后所有数的中位数,保证n是偶数. \(n\le 200000\) 分析: ...
- AtCoder Regular Contest 102
AtCoder Regular Contest 102 C - Triangular Relationship 题意: 给出n,k求有多少个不大于n的三元组,使其中两两数字的和都是k的倍数,数字可以重 ...
- AtCoder Regular Contest 096
AtCoder Regular Contest 096 C - Many Medians 题意: 有A,B两种匹萨和三种购买方案,买一个A,买一个B,买半个A和半个B,花费分别为a,b,c. 求买X个 ...
随机推荐
- LeetCode Happy Number 开心数字
题意: 给出一个整数n,判断其是否为幸运数. 规则是,将n按十进制逐位拆出来后,每个位各自进行取平方,再将这些平方数求和作为新的数字n.若最后n=1,就是幸运数. 思路: 计算例子:n=47,接着n= ...
- 融云SDK触达用户数破20亿 王者风范双倍展现
11月1日,融云SDK触达用户数突破20亿,业务增长速度及用户覆盖量再创即时通讯云领域新高.自去年11月10日公布SDK触达用户数破10亿以来,融云仅用了一年时间,便取得了触达用户数翻倍的成绩,迅猛的 ...
- thisnkphp添加二维码
Rcode二维码生成类QRcode.class.php实例演示 <?php //import('@.Org.QRcode');//thinkphp include_once('QRcode.cl ...
- 《毛毛虫组》【Alpha】Scrum meeting 1
第一天 日期:2019/6/14 1.1 今日完成任务情况以及遇到的问题. 今日完成任务情况: (1)根据数据库设计时的E-R图将创建的表进行检查确保功能的正确实现. (2)进行公共类的设计,设计出程 ...
- 关于SQL语言的初步认识
关于SQL语言的初步认识 1.一个SQL数据库是表(Table)的集合,它由一个或多个SQL模式定义. 2.一个SQL表由行集构成,一行是列的序列(集合),每列与行对应一个数据项. 3.一个表或者是一 ...
- 学习笔记(五): Feature Crosses
目录 Feature Crosses Encoding Nonlinearity Kinds of feature crosses Glossay Crossing One-Hot Vectors P ...
- 【php】php安全问题
使用 —enable-force-cgi-redirect 选项 设置 doc_root 或 user_dir 或 open_basedir PHP运行的用户身份不能为ROOT 数据库字段加密 程序不 ...
- Python入门学习笔记2:刷题
1) LeetCode 强的面试题和算法题,要求也比较高,很多国内外的码农在上面刷题.难度从easy到hard都有,而且覆盖面极广,需要你的综合实力去答题. 最简单的题比如字符串的处理有的时候也要用到 ...
- Django之cookie、session
会话跟踪技术 可以把会话理解为客户端与服务器之间的一次会晤,在一次会晤中可能会包含多次请求和响应. 一次会话过程中,我们应该注意的是什么呢? 那就是,一些操作要保证用户操作的是用户自己个人的数据.举个 ...
- Django之模型---ORM 单表操作
以上一随笔中创建的book表为例讲解单表操作 添加表记录 方式一 # create方法的返回值book_obj就是插入book表中的python葵花宝典这本书籍纪录对象 book_obj=Book.o ...