GYM100526I Interesting Integers】的更多相关文章

题目大意 定义一种 \(Gabonacci\) 数列: \[\begin{array}{c} G_1=a\\ G_2=b\\ G_i=G_{i-1}+G_{i-2} \end{array} \] 给定一个正整数 \(n\) ,求最小的 \(a\) , \(b\) 使得 \(n\) 是该数列上的一个数. \(2\le n\le 10^9\) 题解 看到这道题,首先的想法是可以先与处理出类似于矩阵快速幂一样的东西,使得我们可以在 \(O(1)\) 的时间内算出对于一种 \(a\) 与 \(b\) 在…
Undoubtedly you know of the Fibonacci numbers. Starting with F1 = 1 and F2 = 1, every next number is the sum of the two previous ones. This results in the sequence 1, 1, 2, 3, 5, 8, 13, . . .. Now let us consider more generally sequences that obey th…
题目链接: http://codeforces.com/gym/100526 http://acm.hunnu.edu.cn/online/?action=problem&type=show&id=11672&courseid=0 题目大意: 给定任意一个N,(N<=109)求斐波那契—卢卡斯数列的前两项A和B.(先满足B最小再满足A最小,A<=B) 斐波那契—卢卡斯数列是斐波那契数列的推广,斐波那契数列f[0]=0,f[1]=1,斐波那契—卢卡斯数列f[0]=A,f[…
aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAwwAAAHwCAIAAACE0n9nAAAgAElEQVR4nOydfUBT1f/Hbw9202m0r8…
I. Interesting Integers 传送门 应该是叫思维题吧,反正敲一下脑壳才知道自己哪里写错了.要敢于暴力. 这个题的题意就是给你一个数,让你逆推出递推的最开始的两个数(假设一开始的两个数为x和y),而且要求x<=y. 通过找规律可以发现,这个题就是求解a*x+b*y=k这个方程的x和y的值,并且要x和y为最小满足条件的解.可以找规律出一个公式fi[i]*x+(fi[i-1]+fi[i])*y=n.因为不知道n具体是在第几步推出来的,所以for循环跑一遍预处理出来的斐波那契数列(存…
暑期热身赛 BAPC 2014 The 2014 Benelux Algorithm Programming Contest 题目网址:https://odzkskevi.qnssl.com/365547ace19a71fae35ca0cfb5a843b3?v=1534772800   B Button Bashing #include<stdio.h> #include<bits/stdc++.h> #include<algorithm> #include<ma…
// Button Bashing (bfs) 1 #include <iostream> #include <cstdio> #include <cstring> #include <algorithm> #include <set> #include <map> #include <vector> #include <cmath> #include <queue> using namespace…
B:Button Bashing You recently acquired a new microwave, and noticed that it provides a large number of buttons to be able to quickly specify the time that the microwave should be running for. There are buttons both for adding time, and for subtractin…
1001 Interesting Integers http://www.tzcoder.cn/acmhome/problemdetail.do?&method=showdetail&id=4731 给你[a,b]区间,问有几个数是有趣的数(数字只有一个数不同的),臣妾不行: 1002 Longest Prefix http://www.tzcoder.cn/acmhome/problemdetail.do?&method=showdetail&id=3559 1003 C…
Speed Typing 题意概述 给出两个字符串I和P,问能否通过删除P中若干个字符得到I?如果能的话,需要删除字符的个数是多少? 数据规模 \[1≤|I|,|P|≤10^5 \] 双指针 设置两个指针i和j分别指向I和P的第一个字符,滑动指针j,如果j指向的字符与i指向的字符相同,则让i向后滑动一个字符,当i滑动到I字符串末尾或j滑动到P字符串末尾后即可结束循环.如果i滑动到I字符串末尾,则说明可以通过删除P中若干个字符得到I,那么删除的字符个数为\(|P|-|I|\):反之则不能. 复杂度…
2070. Interesting Numbers Time limit: 2.0 secondMemory limit: 64 MB Nikolay and Asya investigate integers together in their spare time. Nikolay thinks an integer is interesting if it is a prime number. However, Asya thinks an integer is interesting i…
H - Solve this interesting problem Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u Submit Status Practice HDU 5323 Appoint description:  System Crawler  (2015-07-28) Description Have you learned something about segment tr…
题目链接: http://codeforces.com/contest/703/problem/D D. Mishka and Interesting sum time limit per test 3.5 secondsmemory limit per test 256 megabytes 问题描述 Little Mishka enjoys programming. Since her birthday has just passed, her friends decided to prese…
Interesting drink 题目链接: http://codeforces.com/contest/706/problem/B Description Vasiliy likes to rest after a hard work, so you may often meet him in some bar nearby. As all programmers do, he loves the famous drink "Beecola", which can be bough…
转载请注明出处: http://www.cnblogs.com/fraud/          ——by fraud Solve this interesting problem Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1731    Accepted Submission(s): 519 Problem Description…
Mishka and Interesting sum time limit per test 3.5 seconds memory limit per test 256 megabytes input standard input output standard output Little Mishka enjoys programming. Since her birthday has just passed, her friends decided to present her with a…
http://acm.csu.edu.cn/OnlineJudge/problem.php?id=1336 There is an interesting calculator. It has 3 rows of buttons. Row 1: button 0, 1, 2, 3, ..., 9. Pressing each button appends that digit to the end of the display. Row 2: button +0, +1, +2, +3, ...…
D. A and B and Interesting Substrings time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output A and B are preparing themselves for programming contests. After several years of doing sports program…
E. Interesting Graph and Apples 题目连接: http://www.codeforces.com/contest/9/problem/E Description Hexadecimal likes drawing. She has drawn many graphs already, both directed and not. Recently she has started to work on a still-life «interesting graph a…
D. Mishka and Interesting sum time limit per test 3.5 seconds memory limit per test 256 megabytes input standard input output standard output Little Mishka enjoys programming. Since her birthday has just passed, her friends decided to present her wit…
题目传送门 题目大意:给出n个数字,m次区间询问,每一次区间询问都是询问 l 到 r 之间出现次数为偶数的数 的亦或和. 思路:偶数个相同数字亦或得到0,奇数个亦或得到本身,那么如果把一段区间暴力亦或,得到的其实就是出现次数为奇数的数字的亦或和,所以我们希望这段区间内的所有数字出现次数都+1,使奇偶性互换. 我们先处理出前缀的亦或和,这样可以得到次数为奇数的亦或和. 接下来的问题就是要改变一段区间的奇偶性了,也就是说,这个问题其实就转化成了如何求一段区间出现的所有数字(无重复). 这里我学到的是…
There is an interesting calculator. It has 3 rows of buttons. Row 1: button 0, 1, 2, 3, ..., 9. Pressing each button appends that digit to the end of the display. Row 2: button +0, +1, +2, +3, ..., +9. Pressing each button adds that digit to the disp…
2021. Scarily interesting! Time limit: 1.0 secondMemory limit: 64 MB This year at Monsters University it is decided to arrange Scare Games. At the Games all campus gathers at the stadium stands, and the Scare program students divide into two teams to…
题目链接: D. Mishka and Interesting sum time limit per test 3.5 seconds memory limit per test 256 megabytes input standard input output standard output Little Mishka enjoys programming. Since her birthday has just passed, her friends decided to present h…
An interesting mobile game Time Limit: 1000ms Memory Limit: 32768KB This problem will be judged on HDU. Original ID: 329564-bit integer IO format: %I64d      Java class name: Main   XQ,one of the three Sailormoon girls,is usually playing mobile games…
传送门 D. A and B and Interesting Substrings time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output A and B are preparing themselves for programming contests. After several years of doing sports pro…
Interesting Calculator Time Limit: 2 Sec  Memory Limit: 128 MB Submit: 163  Solved: 49 Description There is an interesting calculator. It has 3 rows of buttons.   Row 1: button 0, 1, 2, 3, ..., 9. Pressing each button appends that digit to the end of…
pid=5323" target="_blank" style="">链接 Solve this interesting problem Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 511    Accepted Submission(s): 114 Problem Descriptio…
先上题目: 12664 Interesting CalculatorThere is an interesting calculator. It has 3 rows of button.• Row 1: button 0, 1, 2, 3, . . . , 9. Pressing each button appends that digit to the end of the display.• Row 2: button +0, +1, +2, +3, . . . , +9. Pressin…
Solve this interesting problem Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1479    Accepted Submission(s): 423 Problem Description Have you learned something about segment tree? If not, don’…