C. Anton and Fairy Tale】的更多相关文章

C. Anton and Fairy Tale 题目连接: http://codeforces.com/contest/785/problem/C Description Anton likes to listen to fairy tales, especially when Danik, Anton's best friend, tells them. Right now Danik tells Anton a fairy tale: "Once upon a time, there liv…
链接 [https://codeforces.com/contest/785/problem/C] 题意 初始时有n,第1天先加m开始吃1,但总的不能超过n,第i天先加m开始吃i(如果不够或刚好就吃完,结束了), 问能吃多少天 分析 这个样例,模拟该过程发现规律 如果n<=m,就是n天 否则发现第m+1天比m天剩余的少1,第m+2天比m+1天剩余少2.... 就直接二分搞了 代码 #include<bits/stdc++.h> using namespace std; #define l…
二分. 如果$n≤m$,显然只能$n$天. 如果$n>m$,至少可以$m$天,剩余还可以支撑多少天,可以二分计算得到,也可以推公式.二分计算的话可能爆$long$ $long$,上了个$Java$. import java.math.BigInteger; import java.util.Scanner; public class Main { static Scanner cin = new Scanner(System.in); static BigInteger sum(BigInteg…
当m>=n时,显然答案是n: 若m<n,在第m天之后,每天粮仓减少的量会形成等差数列,只需要二分到底在第几天,粮仓第一次下降到0即可. 若直接解不等式,可能会有误差,需要在答案旁边扫一下. 注意二分上界的确定,不能太小也不能太大. #include<cstdio> #include<iostream> using namespace std; typedef long long ll; ll n,m; int main(){ cin>>n>>m;…
题意: 有一个谷仓容量为\(n\),谷仓第一天是满的,然后每天都发生这两件事: 往谷仓中放\(m\)个谷子,多出来的忽略掉 第\(i\)天来\(i\)只麻雀,吃掉\(i\)个谷子 求多少天后谷仓会空 分析: 分类讨论: 1. \(n \leq m\) 每天都会把谷仓放满,所以第\(n\)后会变空 2. \(n > m\) 前\(m\)天后谷仓还一直都是满的 第\(m+1\)天后还剩\(n-m-1\),第\(m+2\)天后还剩\(n-m-1-2\) 第\(m+i\)天后还剩\(n-m-\frac{…
[题目链接]:http://codeforces.com/contest/785/problem/C [题意] 容量为n的谷仓,每一天都会有m个谷子入仓(满了就视为m);第i天 会有i只鸟叼走i个谷子; 问哪一天谷仓最早变成空的了; [题解] 当n<=m的时候,答案就为n; 当n>m的时候; 从第m+1天起谷仓的入库量比不上鸟的食量了; 会开始减少; 其中第m+1天减少m+1; 此后第m+2-依次减少2,3,4- 即首项为2公差为1的等差数列; 先让n减去m+1 然后让这个数列的和大于等于剩下…
\(数学题,式子并不难推,但边界是真的烦\) \(\color{Red}{Ⅰ.其实可以发现,当m>=n时,每次都可以粮食补到n,所以一定是在第n天消耗完毕}\) \(\color{Purple}{Ⅱ.当n>m时,前m天每次粮食都补到n}\) \(设从m+1天开始,需要mid天消耗完毕\) \(因为每天都可以加m粮食,所以mid天可以加X_{补充}=(mid-1)*m粮食(因为第m+1天是补满前一天的,所以是mid-1)\) \(然后麻雀带走的粮食用等差数列计算m+1,m+2,...,m+mid…
1343. Fairy Tale Time limit: 1.0 secondMemory limit: 64 MB 12 months to sing and dance in a ring their celestial dance. One after another they hold a throne. The first is young and fierce January and the last is elderly and wise December. Leaving the…
n,m<=20,给两个n×m布尔矩阵,每次操作可将第一个矩阵的2个相邻元素互换.输出最少操作次数使得两个矩阵完全一样. 比赛的时候想过按照二分图完美匹配的类似做法构图,不过想到边太多以及卡各种题卡得没脾气,就先放放等赛后搞了... 看题解发现有更好的构图,所以就算当时搞了也是TLE.... 先对所有格子及其上下左右连条流量为inf,费用为1的边,表示使用这条边每次是花费1个操作. 然后将第一个矩阵为1的点连S,流量为1,费用0,表示这个1可以用于满足第二个矩阵的某一个需要 第二个矩阵为1的点连T…
1343 想了好一会 以为会有什么定理呢 没想到 就试着搜了 看来素数还是很多的 跑的飞快 注意会有前导0的情况 还有0,1不是素数... #include <iostream> #include<cstdio> #include<cstring> #include<algorithm> #include<stdlib.h> #include<vector> #include<queue> #include<cmat…
好久没打CF了,打场div2练手.因为比较晚还没提前睡有点神志不清,E题打了莫名其妙的代码调了好久,最后结束后5分钟才发现哪里错了-- AC:ABCD Rank:60 A.Anton and Polyhedrons 题目大意:五种多面体,每种用一个英文单词表示,某人有n个多面体,分别告诉你这n个多面体是什么,求总共多少个面.(n<=200,000) 思路:普及培训,选择结构+循环结构. #include<cstdio> int main() { ;]; scanf("%d&qu…
链接:https://codeforces.com/contest/785 A - Anton and Polyhedrons #include<bits/stdc++.h> using namespace std; ; map<string,int> mp; int n,sum; string str; int main() { ios::sync_with_stdio(); cin.tie(), cout.tie(); mp.clear(); mp[; mp[; mp[; mp…
A. Anton and Polyhedrons 题目链接:http://codeforces.com/contest/785/problem/A 智障水题 实现代码: #include<bits/stdc++.h> using namespace std; int main(){ string s; ,t; cin>>t; while(t--){ cin>>s; if(s=="Tetrahedron") ans+=; else if(s==&quo…
题目链接:http://codeforces.com/contest/785 A. Anton and Polyhedrons time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Anton's favourite geometric figures are regular polyhedrons. Note that there…
A. Anton and Polyhedrons time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Anton's favourite geometric figures are regular polyhedrons. Note that there are five kinds of regular polyhedrons:…
A. Anton and Polyhedrons 直接统计+答案就可以了. #include<cstdio> #include<cstring> #include<algorithm> #include<cmath> #define maxn 1000 #define LL long long using namespace std; ]; int main() { int n; LL sum=; scanf("%d",&n);…
A. Anton and Polyhedrons Anton's favourite geometric figures are regular polyhedrons. Note that there are five kinds of regular polyhedrons: Tetrahedron. Tetrahedron has 4 triangular faces. Cube. Cube has 6 square faces. Octahedron. Octahedron has 8 …
<!doctype html> <html> <head> <meta charset="utf-8" /> <title></title> <style> body { background: #141414; overflow: hidden; } </style> </head> <body> <canvas id="c"><…
C. Woodcutters time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Little Susie listens to fairy tales before bed every day. Today's fairy tale was about wood cutters and the little girl immedi…
  ID PID Title Accepted Submit A 2151 Phone Number 22 74 B 2159 Ivan comes again! 1 17 C 2158 Hello World! 18 70 D 2157 Greatest Number 2 27 E 2156 Fairy tale 0 0 F 2155 Emergency 2 26 G 2154 Shopping 23 42 H 2153 Clockwise 0 0 I 2152 Balloons 7 10 J…
C. Woodcutters time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Little Susie listens to fairy tales before bed every day. Today's fairy tale was about wood cutters and the little girl immedi…
从前有一个fable寓言,讲的是奥巴马穿着棉fabrics织物,走在去往学校的路上,他的心情fabulous极好的,绝妙的.因为他学校的facilities 设施fabulous非常棒,但有些人不喜欢这些,这也是他们辞职的主要factor因素.奥巴马拿着a fact sheet on hurricanes 一份关于飓风的资料走进教室.教室中学生们的欢呼声cheers of the crowd faded away 逐渐消逝.教室内气温是110 Fahrenheit 华氏温度.此时远处传来了模糊的…
链接:https://www.nowcoder.com/acm/contest/116/H来源:牛客网 题目描述 Once there was a king called XOR, he had a lot of land. Because of his name, he likes to play XOR games. One day, he whimpered and wanted to establish N cities on that vast expanse of land, num…
December 11. All circles have the same shape. 所有圆的形状都是相同的.2. She first drew a circle on the board. 她首先在板上画了一个圆.3. He used a small circle and a square. 他使用的是一个小圆形和一个方形.4. You can draw a round face or a square face. 你可以画出圆脸或是方形脸.5. The two triangles co…
Woodcutters CodeForces - 545C Little Susie listens to fairy tales before bed every day. Today's fairy tale was about wood cutters and the little girl immediately started imagining the choppers cutting wood. She imagined the situation that is describe…
Atitit s2018.6 s6  doc list on com pc.docx Atitit s2018.6 s6  doc list on com pc.docx  Aitit algo fix 算法系列补充.docx Atiitt 兼容性提示的艺术 attilax总结.docx Atitit    应用程序容器化总结 v2 s66.docx Atitit   file cms api  uke  api.docx Atitit  docker useage.docx Atitit  E…
https://www.ted.com/talks/james_green_3_moons_and_a_planet_that_could_have_alien_life/transcript00:12Is there life beyond Earth in our solar system? 00:17Wow, what a powerful question. You know, as a scientist -- planetary scientist -- we really didn…
http://codeforces.com/contest/545/problem/C  Woodcutters time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Little Susie listens to fairy tales before bed every day. Today's fairy tale was abo…
In fact, the happiest fairy tale is no more than the simple days we have together. 其实全世界最幸福的童话,也比不上我们一起度过的平常岁月. Fairy tales always end in such scenes: At last, the two lover live together for a happy life. So, even the most romantic love would go bac…
C. Woodcutters Time Limit: 20 Sec  Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/545/problem/C Description Little Susie listens to fairy tales before bed every day. Today's fairy tale was about wood cutters and the little girl immediately s…