随笔分类 - OJ---SPOJ
摘要:Red John has committed another murder. But this time, he doesn't leave a red smiley behind. What he leaves behind is a puzzle for Patrick Jane to solv
阅读全文
摘要:Given a sequence of n numbers a1, a2, ..., an and a number of d-queries. A d-query is a pair (i, j) (1 ≤ i ≤ j ≤ n). For each d-query (i, j), you have
阅读全文
摘要:"Holiday is coming, holiday is coming, hurray hurray!" shouts Joke in the last day of his college. On this holiday, Joke plans to go to his grandmothe
阅读全文
摘要:Taplu and Abhishar loved playing scrabble. One day they thought of inventing a new game using alphabet tiles. Abhishar wrote a string using tiles and
阅读全文
摘要:After the success of 2nd anniversary (take a look at problem FTOUR for more details), this 3rd year, Travel Agent SPOJ goes on with another discount t
阅读全文
摘要:Jonathan Irvin Gunawan is a very handsome living person. You have to admit it to live in this world. To become more handsome, Jonathan the Handsome ha
阅读全文
摘要:Stack is a basic data structure. Where 3 operation can be done- Push: You can push object to the stack Pop: You can pop the object to the stack Top: Y
阅读全文
摘要:Factorial numbers are getting big very soon, you'll have to compute the number of divisors of such highly composite numbers. Input The first line cont
阅读全文
摘要:cathetus(直角边); hypotenuse(斜边) spoj:Structures 给定三角形的直角边,问可以有多少种三角形。 T<=10 , N<=1e15 ,times<=1s. spoj:Shared cathetus (easy) 给定三角形的直角边,问可以有多少种三角形。T<=1e
阅读全文
摘要:都是取的模板,这几天做的素数题挺多的,所以整理了放在这里,感觉有一天回用到的! SPOJ:Nth Prime: 求第N个素数,N<1e9。 #include<bits/stdc++.h> using namespace std; typedef long long ll; const int N=2
阅读全文
摘要:It is Dandiya Night! A certain way how dandiya is played is described: There are N pairs of people playing at a time. Both the person in a pair are pl
阅读全文
摘要:String Play Milo has a string S of length L. Tutu picks a random prefix and Mota picks a random suffix ofS. Now, Chotku is given a task of concatenati
阅读全文
摘要:DCE Coders admins are way much geekier than they actually seem! Kartik has been following that tradition lately. How? Well, he took the inversion coun
阅读全文
摘要:One of DB and TN common interests is traveling. One day, they went to Grand Line and found One Piece ! The One Piece treasure has n gold coins (n is e
阅读全文
摘要:Given a sequence of n numbers a1, a2, ..., an and a number of k-queries. A k-query is a triple (i, j, k) (1 ≤ i ≤ j ≤ n). For each k-query (i, j, k),
阅读全文
摘要:There is a robot on the 2D plane. Robot initially standing on the position (0, 0). Robot can make a 4 different moves: After moving N times Robot gets
阅读全文
摘要:Special Thanks: Jane Alam Jan*At moment in University of Texas at San Antonio - USA You will be given n integers A1A2A3...An. Find a permutation of th
阅读全文
摘要:BTW wants to buy a gift for her BF and plans to buy an integer array. Generally Integer arrays are costly and hence bought the cheapest one from the m
阅读全文
摘要:On September 22, 2004, Oceanic Flight 815 crashed on a mysterious island somewhere in the pacific. There actually were survivors in the crash , N surv
阅读全文
摘要:Rastas's has been given a number n. Being weak at mathematics, she has to consider all the numbers from 1 to 2n - 1 so as to become perfect in calcula
阅读全文