ZOJ 2965 Accurately Say "CocaCola"!】的更多相关文章

Accurately Say "CocaCola"! Time Limit: 2 Seconds      Memory Limit: 65536 KB In a party held by CocaCola company, several students stand in a circle and play a game. One of them is selected as the first, and should say the number 1. Then they co…
Time Limit: 2 Seconds      Memory Limit: 65536 KB In a party held by CocaCola company, several students stand in a circle and play a game. One of them is selected as the first, and should say the number 1. Then they continue to count number from 1 on…
Accurately Say "CocaCola"! 范围找到:1--700左右,然后打表就ok了 #include<cstdio> #include<cstdlib> #include<iostream> using namespace std; bool a[810]; int sum[810]; int pos[810]; void _judge(int v) { if(v%7==0){ a[v]=true; return ; } int t=…
http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=2965 题意:一群人玩过“7”的游戏,有7的数字或者7的倍数就要喊“cocacola”.给出一个数字p,求连续要喊“cocacola”p次的最小数字s: 思路:刚开始想着,2是27,3-10都是70,11-100都是700...后来一直WA,打个表才知道,270-280有11个....所以.... #include<bits/stdc++.h> using namespa…
ZOJ Problem Set - 2965 Accurately Say "CocaCola"!  http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=2965 打表.求含有7或者是7的倍数的数.题目输入p,输出第一个连续出现p个满足条件的头. #include<cstdio> #include<cstring> #include<algorithm> #define mt(a,…
杭电ACM分类: 1001 整数求和 水题1002 C语言实验题——两个数比较 水题1003 1.2.3.4.5... 简单题1004 渊子赛马 排序+贪心的方法归并1005 Hero In Maze 广度搜索1006 Redraiment猜想 数论:容斥定理1007 童年生活二三事 递推题1008 University 简单hash1009 目标柏林 简单模拟题1010 Rails 模拟题(堆栈)1011 Box of Bricks 简单题1012 IMMEDIATE DECODABILITY…
Accurately Say "CocaCola"! Time Limit: 2 Seconds      Memory Limit: 65536 KB In a party held by CocaCola company, several students stand in a circle and play a game. One of them is selected as the first, and should say the number 1. Then they co…
转载:from http://blog.csdn.net/qq_28236309/article/details/47818349 基础题:1000.1001.1004.1005.1008.1012.1013.1014.1017.1019.1021.1028.1029. 1032.1037.1040.1048.1056.1058.1061.1070.1076.1089.1090.1091.1092.1093. 1094.1095.1096.1097.1098.1106.1108.1157.116…
A - Accurately Say "CocaCola"! In a party held by CocaCola company, several students stand in a circle and play a game. One of them is selected as the first, and should say the number 1. Then they continue to count number from 1 one by one (cloc…
  ZOJ Problem Set - 1090 The Circumference of the Circle Time Limit: 2 Seconds      Memory Limit: 65536 KB To calculate the circumference of a circle seems to be an easy task - provided you know its diameter. But what if you don't? You are given the…
The Pilots Brothers' refrigerator Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 22286   Accepted: 8603   Special Judge Description The game “The Pilots Brothers: following the stripy elephant” has a quest where a player needs to open a…
第十三届浙江省大学生程序设计竞赛 I 题, 一道模拟题. ZOJ  3944http://www.icpc.moe/onlinejudge/showProblem.do?problemCode=3944 In a BG (dinner gathering) for ZJU ICPC team, the coaches wanted to count the number of people present at the BG. They did that by having the waitre…
A Simple Tree Problem Time Limit: 3 Seconds      Memory Limit: 65536 KB Given a rooted tree, each node has a boolean (0 or 1) labeled on it. Initially, all the labels are 0. We define this kind of operation: given a subtree, negate all its labels. An…
先列出题目: 1.POJ 1753 POJ 1753  Flip Game:http://poj.org/problem?id=1753 Sample Input bwwb bbwb bwwb bwww Sample Output 4 入手竟然没有思路,感觉有很多很多种情况需要考虑,也只能使用枚举方法才能解决了吧~ 4x4的数组来进行数据存储的话操作起来肯定非常不方便,这里借用位压缩的方法来存储状态,使用移位来标识每一个位置的的上下左右的位置操作. 详细看这里. 1.当棋盘状态id为0(全白)或…
这道题目还是简单的,但是自己WA了好几次,总结下: 1.对输入的总结,加上上次ZOJ Problem Set - 1334 Basically Speaking ac代码及总结这道题目的总结 题目要求输入的格式: START X Y Z END 这算做一个data set,这样反复,直到遇到ENDINPUT.我们可以先吸纳一个字符串判断其是否为ENDINPUT,若不是进入,获得XYZ后,吸纳END,再进行输出结果 2.注意题目是一个圆周,所以始终用锐角进行计算,即z=360-z; 3.知识点的误…
放了一个长长的暑假,可能是这辈子最后一个这么长的暑假了吧,呵呵...今天来实验室了,先找了zoj上面简单的题目练练手直接贴代码了,不解释,就是一道简单的密文转换问题: #include <stdio.h> #include <string.h> int main() { char cText[1000]; char start[10]; char end[5]; while(scanf("%s",start)!=EOF&&strcmp(start…
这道题目说白了是一道平面几何的数学问题,重在理解题目的意思: 题目说,弗雷德想买地盖房养老,但是土地每年会被密西西比河淹掉一部分,而且经调查是以半圆形的方式淹没的,每年淹没50平方英里,以初始水岸线为x轴,平分半圆为y轴,建立如下图的坐标系 问题:给出坐标点(y>0),让你判断在那一年这个坐标点会被淹没. 解决方案:我们可以转换成的数学模型是来比较坐标点到原点的距离与半圆半径的大小即可知道该点是否被淹没,公式如下: 1.由于每年半圆面积增长50平方英里,可得半径递推公式R2=sqrt(100/p…
今天在ZOJ上做了道很简单的题目是关于加密解密问题的,此题的关键点就在于求余的逆运算: 比如假设都是正整数 A=(B-C)%D 则 B - C = D*n + A 其中 A < D 移项 B = A+C + D*n 当B<D时,两边对D取摸,  B = B%D = ( A+C + D*n )%D = (A+C)%D 由此可得此题答案,见代码 #include <cstdio> #include <cstring> int main() { ]; ],ctext[]; w…
ZOJ ACM题集,编译环境VC6.0 #include <stdio.h> int main() { int a,b; while(scanf("%d%d",&a,&b)!=EOF) { printf("%d\n",a+b); } ; }…
zoj 1788 先输入初始化MAP ,然后要根据MAP 建立一个四分树,自下而上建立,先建立完整的一棵树,然后根据四个相邻的格 值相同则进行合并,(这又是递归的伟大),逐次向上递归 四分树建立完后,再进行一深度优先遍历,生成二进制字符串,再转化为16进制输出 //#include "stdafx.h" #include <string.h> #include <string> #include <queue> #include <iostre…
题目链接: ZOJ 1958. Friends 题目简介: (1)题目中的集合由 A-Z 的大写字母组成,例如 "{ABC}" 的字符串表示 A,B,C 组成的集合. (2)用运算符三种集合运算,'+' 表示两个集合的并集,'*' 表示两个集合的交集, '-' 表示从第一个集合中排除第二个集合包含的元素. (3)给出这样的表达式,求出表达式结果(按照字母顺序).运算符优先级和编程语言中的规定相同,即优先级从高到低为括号,乘号,加/减号:相同优先级时从左向右. 例如: "{AB…

ZOJ

某年浙大研究生考试的题目. 题目描述: 对给定的字符串(只包含'z','o','j'三种字符),判断他是否能AC. 是否AC的规则如下:1. zoj能AC:2. 若字符串形式为xzojx,则也能AC,其中x可以是N个'o' 或者为空:3. 若azbjc 能AC,则azbojac也能AC,其中a,b,c为N个'o'或者为空: 输入: 输入包含多组测试用例,每行有一个只包含'z','o','j'三种字符的字符串,字符串长度小于等于1000. 输出: 对于给定的字符串,如果能AC则请输出字符串“Acc…
并查集+左偏树.....合并的时候用左偏树,合并结束后吧父结点全部定成树的根节点,保证任意两个猴子都可以通过Find找到最厉害的猴子                       Monkey King Time Limit: 10000MS   Memory Limit: 32768KB   64bit IO Format: %lld & %llu [Submit]   [Go Back]   [Status] Description Once in a forest, there lived…
树形DP.... Tree of Tree Time Limit: 1 Second      Memory Limit: 32768 KB You're given a tree with weights of each node, you need to find the maximum subtree of specified size of this tree. Tree Definition A tree is a connected graph which contains no c…
其实zoj 3415不是应该叫Yu Zhou吗...碰到ZOJ 3415之后用了第二个参考网址的方法去求通项,然后这次碰到4870不会搞.参考了chanme的,然后重新把周瑜跟排名都反复推导(不是推倒)四五次才上来写这份有抄袭嫌疑的题解... 这2题很类似,多校的rating相当于强化版,不过原理都一样.好像是可以用高斯消元做,但我不会.默默推公式了. 公式推导参考http://www.cnblogs.com/chanme/p/3861766.html#2993306 http://www.cn…
BCD Code Time Limit: 5 Seconds      Memory Limit: 65536 KB Binary-coded decimal (BCD) is an encoding for decimal numbers in which each digit is represented by its own binary sequence. To encode a decimal number using the common BCD encoding, each dec…
Time Limit: 2 Seconds      Memory Limit: 65536 KB When we are focusing on solving problems, we usually prefer to stay in front of computers rather than go out for lunch. At this time, we may call for food delivery. Suppose there are N people living i…
Time Limit:2000MS     Memory Limit:65536KB     64bit IO Format:%lld & %llu Submit Status Practice ZOJ 3795 Description Suppose there are N people in ZJU, whose ages are unknown. We have some messages about them. The i-th message shows that the age of…
zoj 2833这次真的很顺利了..居然是因为数组的大小没有符合要求,瞎折腾了很久..没有注意到要求范围,真是该死! 想法很简单,就是定义一个父结点数组,下标 i 表示这个元素,初始化为 -1表示 这个元素的朋友只有自己,当parent[i]为负数时,朋友的个数就是|parent[i]| 即绝对值,如果parent[i]为正数,则表示 i的父结点.通过find找到i的根,其中使用了权重合并,即结点少的合并在结点多的树上.注意如果根相同,即已经 是朋友了,就不需要再合并了. 真是好神奇的并查集,将…
Dividing a Chocolate zoj 2705 递推,找规律的题目: 具体思路见:http://blog.csdn.net/u010770930/article/details/9769333 #include <stdio.h> #include <iostream> using namespace std; ]; int main() { int i,j,maxx; long long m,n; a[]=; a[]=; while(~scanf("%lld…