CF1455A Strange Functions 题解】的更多相关文章

Content 定义一个函数 \(f(x)\) 为 \(x\) 翻转并去掉前导零之后的数,现在有 \(t\) 组询问,每组询问给定一个整数 \(n\),请求出对于所有的 \(1\leqslant x\leqslant n\),\(g(x)=\dfrac{x}{f(f(x))}\) 的取值有多少种. 数据范围:\(1\leqslant t\leqslant 100,1\leqslant n<10^{100}\). Solution 签到题. 我们发现,如果一个数 \(x\) 有 \(k\) 个 \…
Problem Description There is a strange lift.The lift can stop can at every floor as you want, and there is a number Ki(0 <= Ki <= N) on every floor.The lift have just two buttons: up and down.When you at floor i,if you press the button "UP"…
A strange lift Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 33697    Accepted Submission(s): 12038 Problem Description There is a strange lift.The lift can stop can at every floor as you want…
Problem Description Now, here is a fuction: F(x) = 6 * x^7+8x^6+7x^3+5x^2-yx (0 <= x <=100) Can you find the minimum value when x is between 0 and 100. Input The first line of the input contains an integer T(1<=T<=100) which means the number o…
Content 给定一个 \(n\times m\) 的矩阵.一开始,\((1,1)\) 所在位置上面的数是 \(1\),随后先由上往下将这一列中的所有位置上面填上 \(2,3,\dots,n\),再依次对右边的所有列由上往下填上 \(n+1,n+2,\dots,2n,2n+1,2n+2\dots,3n,\dots,m\cdot n\). 现在改变一种填数方式.一开始 \((1,1)\) 所在位置上面的数还是 \(1\),随后先由左往右将这一行中的所有位置填上 \(2,3,\dots,m\),再…
国际 C 语言混乱代码大赛(IOCCC, The International Obfuscated C Code Contest)是一项国际编程赛事,从 1984 年开始,每年举办一次(1997年.1999年.2002年.2003年和2006年例外).目的是写出最有创意的最让人难以理解的C语言代码. 获奖者列表 1984 anonymous    prints hello world, where read is write 1984 decot    prints garbage, weird…
堆栈基础 堆栈(stack)具有“后进先出”的特性,利用这个特性我们可以用堆栈来解决这样一类问题:后续的输入会影响到前面的阶段性结果.线性地遍历输入并用stack处理,这类问题较简单,求解时间复杂度一般为O(n). 相关LeetCode题: 13. Roman to Integer  题解 20. Valid Parentheses  题解 844. Backspace String Compare  题解 1047. Remove All Adjacent Duplicates In Stri…
http://poj.org/problem?id=2891 题目大意: k个不同的正整数a1,a2,...,ak.对于一些非负m,满足除以每个ai(1≤i≤k)得到余数ri.求出最小的m. 输入和输出中的所有整数都是非负数,可以用64位整数类型表示. —————————————— 首先我们打眼一看可能是孙子定理. 但是我们无法保证a一定互质. 那么显然就要用我们的可爱的exgcd啦! (下面题解根据这位大佬所懂http://blog.csdn.net/zmh964685331/article/…
传送门 首先想了黑白染色,发现不会染 其实可以考虑如何动态地维护出这个点集 发现题面里对不在点集之中的点之间的连边没有要求 所以考虑不断向图中加点,为了满足要求,每次取一个与当前新图中相连的点 若它与点集中的点有连边,那它不能选入点集 如果没有,那它必须选入点集,否则这个点不满足「通过开启边可达」的要求 但如何证明这样下去得到的点集一定满足「通过开启边可达」的要求呢? 发现加了「开启边」这个要求之后非点集中的点之间的连边就废了 那图就成了二分图了 而我们加边时所加的所有边构成一条链,这条链连通了…
突然很想刷刷题,LeetCode是一个不错的选择,忽略了输入输出,更好的突出了算法,省去了不少时间. dalao们发现了任何错误,或是代码无法通过,或是有更好的解法,或是有任何疑问和建议的话,可以在对应的随笔下面评论区留言,我会及时处理,在此谢过了. 过程或许会很漫长,也很痛苦,慢慢来吧. 编号 题名 过题率 难度 1 Two Sum 0.376 Easy 2 Add Two Numbers 0.285 Medium 3 Longest Substring Without Repeating C…
Small The first rule of functions is that they should be small.The second rule of functions is that they should be smaller than that.Functions should hardly ever be 20 lines long. Blocks and indenting This implies that the blocks within if statements…
Strange Billboard 题目链接: http://acm.hust.edu.cn/vjudge/contest/129733#problem/A Description The marketing and public-relations department of the Czech Technical University has designed a new reconfigurable mechanical Flip-Flop Bill-Board (FFBB). The b…
Callback functions are extremely important in Javascript. They’re pretty much everywhere. Originally coming from a more traditional C/Java background I had trouble with this (and the whole idea of asynchronous programming), but I’m starting to get th…
转自: http://recurial.com/programming/understanding-callback-functions-in-javascript/ Callback functions are extremely important in Javascript. They’re pretty much everywhere. Originally coming from a more traditional C/Java background I had trouble wi…
Strange fuction Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 4599    Accepted Submission(s): 3304 Problem Description Now, here is a fuction:  F(x) = 6 * x^7+8*x^6+7*x^3+5*x^2-y*x (0 <= x <=…
用了两场比赛上Div 1感觉自己好腊鸡的说...以下是这两场比赛的部分题解(不得不说有个黄学长来抱大腿还是非常爽的) Round #372 : Div 2 A:Crazy Computer 题意:给定N个输入和一个时间长度M,每次输入屏幕上增加一个字符,若两个输入间隔大于M则屏幕上的字符会被清空,问结束时屏幕上还有多少个字符 直接模拟没有什么好说的 代码: #include<cstdio> #include<iostream> #include<cstring> #in…
拓展欧几里得:求导&二分 POJ-1061 拓展欧几里得的应用,需要开long long 第一次做这个题的时候进行了毫无用处的找公式(?),是个现在的我看不懂的迷之思路. 第二发的时候还是不明白位数与数据大小的年轻人,1e9以上开long long,可以到1e18,2^63以上直接ull,2^64及以上考虑一下换思路吧. 先放乱码 #include<cstdio> #include<iostream> using namespace std; long long r; lo…
C.Functions again 题意 给你一个数组a[1..n].有一个函数\(f(l,r)=\sum_{i=l}^{r-1}\left| a[i]-a[i+1]\right| (-1)^{l-i}(1\le l< r\le n)\),求f最大值. 题解 令b[i]=|a[i]-a[i+1]|(-1)^i,c[i]=-b[i].那么答案就是b数组和c数组的最大子序列和中较大的一个. 代码 const int N=101000; ll n,a[N],s; ll ans,mb,mc; int m…
D. Vitya and Strange Lesson 题意 数列里有n个数,m次操作,每次给x,让n个数都异或上x.并输出数列的mex值. 题解 01字典树保存每个节点下面有几个数,然后当前总异或的是sw,则sw为1的位的节点左右孩子交换(不用真的交换).左孩子的值小于左边总节点数则mex在左子树,否则在右子树. 代码 const int N=531000;//3e5<2^19<N int sw=0; struct Trie{ int ch[N*20][2]; int cnt[N*20];…
Anastasia and pebbles 题意:你有两种框,每个框可以最多装k重量的物品,但是你每个框不能装不一样的物品.现在地面上有n个物品,问你最少多少次,可以把这n个物品全部装回去. 题解:其实就是问你得用多少次框,然后把多少次除以2就好了.每次装k的物品装回去就好了. 代码: #include<bits/stdc++.h> using namespace std; const int maxn = 1e5+7; int a[maxn],n,k; int main(){ scanf(&…
C. Efim and Strange Grade 题目连接: http://codeforces.com/contest/719/problem/C Description Efim just received his grade for the last test. He studies in a special school and his grade can be equal to any positive decimal fraction. First he got disappoin…
原文:https://medium.freecodecamp.org/learn-es6-the-dope-way-part-ii-arrow-functions-and-the-this-keyword-381ac7a32881 ----------------------------------------------------------- Welcome to Part II of Learn ES6 The Dope Way, a series created to help you…
刷题备忘录,for bug-free 招行面试题--求无序数组最长连续序列的长度,这里连续指的是值连续--间隔为1,并不是数值的位置连续 问题: 给出一个未排序的整数数组,找出最长的连续元素序列的长度. 如: 给出[100, 4, 200, 1, 3, 2], 最长的连续元素序列是[1, 2, 3, 4].返回它的长度:4. 你的算法必须有O(n)的时间复杂度 . 解法: 初始思路 要找连续的元素,第一反应一般是先把数组排序.但悲剧的是题目中明确要求了O(n)的时间复杂度,要做一次排序,是不能达…
Strange Class Time Limit: 1 Sec  Memory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/showproblem.php?pid=5198 Description In Vivid’s school, there is a strange class(SC). In SC, the students’ names are very strange. They are in the same format: anbncn(a,…
[POJ2891]Strange Way to Express Integers(拓展CRT) 题面 Vjudge 板子题. 题解 拓展\(CRT\)模板题. #include<iostream> #include<cstdio> using namespace std; #define ll long long #define MAX 111111 ll exgcd(ll a,ll b,ll &x,ll &y) { if(!b){x=1,y=0;return a;…
http://www.chami.com/tips/delphi/112696D.html Sometimes it's necessary to pass undefined number of [different type] variables to a function -- look at Format() function in Delphi and *printf() functions in C/C++ for example. Once you analyze the foll…
题目链接: http://acm.hust.edu.cn/vjudge/problem/87213 Strange Antennas Time Limit: 3000MS 题意 一个雷达能够辐射到的范围为等腰三角形,现在给你雷达的坐标,辐射范围和方向,问你求被奇数个雷达辐射到的网格有多少个. 题解 首先,雷达是建在交叉点上的,而考虑覆盖范围是在网格上的,所以需要坐标转换(题目样例第四行有错,应为1,5,4,0). 其次我们可以考虑每一行都做一遍,然后枚举每个雷达对这一行的影响,没个雷达对这一行的…
time limit per test 1 second memory limit per test  256 megabytes input standard input output standard output Ivan is playing a strange game. He has a matrix a with n rows and m columns. Each element of the matrix is equal to either 0 or 1. Rows and…
C. Efim and Strange Grade time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Efim just received his grade for the last test. He studies in a special school and his grade can be equal to any po…
Discription Bash got tired on his journey to become the greatest Pokemon master. So he decides to take a break and play with functions. Bash defines a function f0(n), which denotes the number of ways of factoring n into two factors p and q such that …