cf--------(div1)1A. Theatre Square】的更多相关文章

A. Theatre Square Theatre Square in the capital city of Berland has a rectangular shape with the size n × m meters. On the occasion of the city's anniversary, a decision was taken to pave the Square with square granite flagstones. Each flagstone is o…
A - Theatre Square Time Limit:2000MS     Memory Limit:65536KB     64bit IO Format:%I64d & %I64u Submit Status Practice CodeForces 1A Description Theatre Square in the capital city of Berland has a rectangular shape with the size n × m meters. On the…
A. Theatre Square time limit per test 2 seconds memory limit per test 64 megabytes input standard input output standard output Theatre Square in the capital city of Berland has a rectangular shape with the size n × m meters. On the occasion of the ci…
题目大意; 有一个广场,广场的大小是n*m,  有a*a的石砖,石砖铺广场可以比广场大,石砖不能切割.问最少需要多少个石砖. ===================================================================== #include <iostream> #include <cmath> #include <algorithm> #include <string> #include <deque>…
Theatre Square time limit per test 2 seconds memory limit per test 64 megabytes input standard input output standard output Theatre Square in the capital city of Berland has a rectangular shape with the size n × m meters. On the occasion of the city'…
http://codeforces.com/problemset/problem/1/A Theatre Square time limit per test 2 seconds memory limit per test 64 megabytes input standard input output standard output Theatre Square in the capital city of Berland has a rectangular shape with the si…
A. Theatre Square time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Theatre Square in the capital city of Berland has a rectangular shape with the size n × m meters. On the occasion of the ci…
题目链接:B.New Theatre Square 题意: 你要把所有"." 都变成"*",你可以有两个选择,第一种就是一次铺一个方块(1*1),第二种就是同一行一次铺两个(1*2).第一种花费x,第二种花费y.问最少花费多少能把所有铺完 题解: 如果y>=2*x,那么就直接找到所有".",然后乘于x就行 否则就找俩俩一对就行了 代码: 1 #include<stdio.h> 2 #include<algorithm>…
A. Dreamoon and Sums time limit per test 1.5 seconds memory limit per test 256 megabytes input standard input output standard output Dreamoon loves summing up something for no reason. One day he obtains two integers a and b occasionally. He wants to…
B. Dreamoon and Sets time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Dreamoon likes to play with sets, integers and . is defined as the largest positive integer that divides both a and b. L…
题目链接:http://www.codeforces.com/problemset/problem/1/A题意:至少用多少块边长为a的方块铺满NxM的矩形区域.C++代码: #include <iostream> using namespace std; int main() { long long n, m, a; cin >> n >> m >> a; cout << ((n+a-)/a) * ((m+a-)/a); ; } C++…
从今天開始.就要在Codeforces里有一个新的開始了,貌似任务非常重的说~~ Codeforces专题我将会记录全部通过的题目,事实上仅仅要通过的题目都是水题啊!. 题目大意: 依照要求计算须要多少flagstone. 以下是代码: #include <stdio.h> int main() { long long n,m,a,r,c; scanf("%I64d%I64d%I64d",&n,&m,&a); r=n/a; if(n%a)r++; c…
题意 有一个 n×m 的广场,其中一部分要铺地砖,地砖有两种, 1 × 1 和 1×2 的,后者只能横着铺,其中, 1 × 1的单价为 x , 1 × 2 的单价为 y , 输入这个广场,"."表示要铺地砖,求最少花费.注意,地砖不可重合,也不可覆盖在已铺地砖区域. 思路 这显然是贪心,分别计算全铺 $ 1 × 1$ 的方案价钱和尽量多铺 $ 1 × 2$ 的方案价钱,最后将最小的输出,因为只能横铺,方向固定,所以十分简单. 代码 具体细节见注释 #include<bits/st…
题目链接:https://codeforces.com/contest/1359/problem/B 题意 有一块 $n \times m$ 的地板和两种瓷砖: $1 \times 1$,每块花费为 $x$ $1 \times 2$,每块花费为 $y$ 地板为 '.' 表示未铺瓷砖,瓷砖不可旋转, 问铺满瓷砖的最小花费. 题解 因为 $1 \times 2$ 的瓷砖不能旋转,所以每次逐行考虑即可,注意 $y$ 取 $min(2x, y)$ . 代码 #include <bits/stdc++.h…
Codeforces印象 这两天抽时间去codeforces体验了一把. 首先,果然有众多大牛存在.非常多名人一直參加每周一次的比赛.积分2000+,并參与出题. 另外.上面题目非常多.预计至少一千题. 比赛结束后,题目将转为练习题,能够持续尝试.每道题目都有标签,如greedy. math, matrices等等,能够点击对应的标签仅仅做相关的题目.可惜我做了好几道之后才发现. 这次解决的题目 首次尝试.这次做的几个都是选的完毕人数最多的,比較简单,但还是有些东西是从中新学习到的.以后最好分类…
/* CF#190DIV.1-C 题意:给你n个结点的树,给这些结点标记字母AB..Z,对于标记相同的结点路径上 的结点的标记必须有一个是大于该标记的:问是否可以标记(A是最大标记) 分析:整天思路就是找一个点,然后标记为最大标记i,然后再分别以最大标记i+1,标记该点的子树 依次递归:最终如果标记<=Z就是可以的: 因为只有10^5个点,最长情况下需要logn个不同的标记对于n个结点的树(成一条链) 2^26>log(10^5) 所以必定有解: 而那个点,最优的应该就是树的重心,重心的定义:…
A. Theatre Square time limit per test 2 seconds memory limit per test 64 megabytes input standard input output standard output Theatre Square in the capital city of Berland has a rectangular shape with the size n × m meters. On the occasion of the ci…
第一题 1A A. Theatre Square time limit per test 2 seconds memory limit per test 64 megabytes input standard input output standard output Theatre Square in the capital city of Berland has a rectangular shape with the size n × m meters. On the occasion of…
Theatre Square CodeForces - 1A 一个城市的广场面积有 N×M平方米,过段时间,恰逢这个城市的庆典活动,主办方决定在广场上铺设一种新的地砖,这种地砖每块都是a×a平方米的.那么问题来了,最少需要多少地砖才能铺满整个广场呢?地砖一定要把广场铺满,允许地砖面积可以超过广场,同时,铺地砖的时候地砖的边必须和广场的边是平行的. Input 输入数据包含三个正整数n,m,a(1 ≤  n, m, a ≤ 1000000000). Output 输出最少的地砖数量. Sample…
Codeforces Beta Round #83 (Div. 1 Only) A. Dorm Water Supply 题意 给你一个n点m边的图,保证每个点的入度和出度最多为1 如果这个点入度为0,那么这个点就是水龙头点. 如果这个点的出度为0,那么这个点就是储存点. 现在让你把所有水龙头到储存点的路径都输出出来,且输出这条路径的边权最小值 题解 显然是个仙人掌图,所以直接XJB暴力就好了 代码 #include<bits/stdc++.h> using namespace std; co…
QAQ 总觉得自己要做点什么 可是并不知道去做些什么 QAQ 先挖一些坑吧,不管怎么样,把这些坑填完估计NOI也就无憾了 1.读完13-16的论文 QAQ 2.做完12-16的POI  QAQ 3.做完10-15的NOI的题目 QAQ 4.把自己一些想学会的算法学会 5.BZOJ 500+ 题目 6.完成全套的复习计划(从7.1开始制定并开始) 八月份!三个月!QAQ UPD:感觉计划太笼统了OwO 根本没有效果,看来还是要强迫自己啊 Em 从今天开始更新blog 每日一更(这是个大坑 内容包括…
 A- Theatre Square Time Limit:2000MS     Memory Limit:65536KB     64bit IO Format:%I64d & %I64u Description Theatre Square in the capital city of Berland has a rectangular shape with the size n × m meters. On the occasion of the city's anniversary, a…
A. Theatre Square 题目大意:有一个长宽为m和n的广场,用边长为a的正方形去铺盖,问铺满最少需要多少正方形 题解:题目分解为用长度为a的线条分别去覆盖长度为m和n的线条,计算两者的乘积就是答案,在计算时注意整除的情况以及需要开long long防止相乘时范围越界. #include <iostream> using namespace std; int main(){ long long n,a,m,p1,p2; cin>>n>>m>>a;…
A. Theatre Square time limit per test:1 second memory limit per test:256 megabytes input:standard input output:standard output Theatre Square in the capital city of Berland has a rectangular shape with the size n × m meters. On the occasion of the ci…
之所以在codeforces上找这100道水题的原因是为了巩固我对最近学的编程语言的掌握程度. 找的方式在codeforces上的PROBLEMSET中过的题最多的那些题里面出现的最前面的10个题型,它们是: math(数学) brute force(暴力) strings(字符串) implementation(模拟) greedy(贪心) sortings(排序) number theory(数论) constructive algorithm dp(动态规划) shortest path(…
Linux网络编程--以太网 宗旨:技术的学习是有限的,分享的精神是无限的. 1.以太网帧格式 源地址和目的地址是指网卡的硬件地址(也叫MAC地址),长度是48位,是在网卡出厂时固化的.用ifconfig命令查看," 硬件地址 00:0c:29:cf:7e:1a " .协议字段有三种值,分别相应IP. ARP. RARP.帧末尾是CRC校验码. ARP和RARP数据包的长度不够46字节.要在后面补填充位. 最大值1500称为以太网的最大传输单元( MTU),不同的网络类型有不同的MTU…
目标 感觉起来NOIP还是能考到一个比较好的分数的吧 550+? 现在可能还不大行,但是过3个月或许还是能考到的 所以先订下NOIP保底500争取550+吧 至于省选... 前面有一群巨佬挡着,感觉想进队希望渺茫,D类也不好说 不过从分数上来讲还是可以保证一个基本分的 每天至少得150吧 就是t1A掉或者很高的部分分加上后两题的暴力,这个应该比较基础 然后争取冲200?从今年的感觉上四天平均180+就能进队了啊... 好像很困难啊 希望能实现吧 小目标&计划 难得写一次计划啊 先列一个月的计划吧…
A Theatre Square(数学) 算出每行能装多少乘以每列能装多少就行 公式 ans=ceil(n/a)+ceil(m/a) 代码 #include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); long long n,m,a; cin>>n>>m>>a; cout<<(n/a+(n%a…
论蒟蒻如何被cf虐 以下是身败名裂后的题解菌=========== Div1 A.Watchmen 有n个点,每个点有一个坐标.求曼哈顿距离=欧几里得距离的点对数量. 只需要统计x或y一样的点对数量.容斥即可.注意long long.(sad story //By zzq #include <iostream> #include <stdio.h> #include <stdlib.h> #include <algorithm> #include <s…
CF#462 div1 D:A Creative Cutout 题目大意: 原网址戳我! 题目大意: 在网格上任选一个点作为圆中心,然后以其为圆心画\(m\)个圆. 其中第\(k\)个圆的半径为\(\sqrt{k}\),\(m\)个圆的编号依次为\(1\)~\(m\). 定义一个格点的美妙值\(g(x,y)\)为包含了它的所有圆的编号之和. 定义\(f(n)\)为:当画了\(n\)个圆时,\(f(n) = \sum_{i,j\in R} g(i,j)\). 现在非常变态的问你一个非常无聊的恶心问…