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个 ...
随机推荐
- 两个div并列居中显示——当display:inline;时,div的宽高不起作用即两个div重叠显示
解决办法: 将display设置为:inline-block
- javaSe-线程2
package com.java.chap09.sec02; public class Thread3 implements Runnable{ private int baoZi=1; privat ...
- userBean设置属性2
package com.java.model; public class Student { private String name;private int age; public String ge ...
- HDU 2089 不要62 (数位DP,入门)
题意: 只要含连续的62,或者含4的车牌号码都是不吉利的,其他都是吉利的组合.问区间[L,R]中有多少个数是吉利的? 思路: 依然是利用树(10进制是十叉树)的思想,统计左边所有子树有多少个数是吉利的 ...
- LeetCode Pascal's Triangle Pascal三角形
题意:给一个数字,返回一个二维数组,包含一个三角形. 思路:n=0.1.2都是特例,特别处理.3行以上的的头尾都是1,其他都是依靠上一行的两个数.具体了解Pascal三角形原理. class Solu ...
- 【Python图像特征的音乐序列生成】一个更科学的图片分类参考方法,以及一个看起来很好用的数据集
数据集地址:http://www.imageemotion.org/ 论文地址:http://www.doc88.com/p-1905670442096.html
- (转)在SQL Server 2016,Visual Studio 2017环境下,连接数据库屡屡失败,在connectionString上出的问题
适用情景: 1,ServerVersion出了问题,“SqlCnt.ServerVersion”引发了类型“System.InvalidOperationException”的异常 2,在String ...
- OpenGL小试牛刀第二季(粒子模拟)
效果截图:粒子模拟代码展示:#include "Particle.h" /** 构造函数 */CParticle::CParticle(){ data = NULL; numpar ...
- Oracle 11g 新特性 – HM(Hang Manager)简介
在这篇文章中我们会对oracle 11g 新特性—hang 管理器(Hang Manager) 进行介绍.我们需要说明,HM 只在RAC 数据库中存在. 在我们诊断数据库问题的时候,经常会遇到一些数据 ...
- CoreData介绍
http://blog.csdn.net/zh952016281/article/details/52105683 写在前面 在CoreData中有一些常用的类,称呼可能各不相同.所以这里先约定一些关 ...