this is a programming practice called rupsa and the game:
Princess Rupsa saw one of her friends playing a special game. The game goes as follows:
N+1 numbers occur sequentially (one at a time)...
Type: Posts; User: V8cTor
this is a programming practice called rupsa and the game:
Princess Rupsa saw one of her friends playing a special game. The game goes as follows:
N+1 numbers occur sequentially (one at a time)...
yeah maybe but according to me, the latter also works fine.
why are functions for finding square written as
double square(double x){
return x*x;
}
instead of
when i try to build it, it says:
error C2661: 'std::vector<int,std::allocator<_Ty>>::vector' : no overloaded function takes 7 arguments
Iam trying to declare a class with a vector that is initialized as follows:
#include<vector>
class S
{
std::vector<int> v = { 1, 2, 3, 4, 5, 6, 7 };
};
int main()
{
when i commented line 21:long long length = 1 + cycleLength(next(n));
all the obscure messages about include/xutility disappeared.
Here are the compile errors:
1>------ Build started:...
I can't get this code to compile in Microsoft Visual Studio 2013(it compiled in code blocks).
I only need to know where the error is.
Please help :(
#include"stdafx.h"
#include<iostream>...
I found the solution!
Previously i ignored the fact that while getting inputs for i and j, j could be greater than i.
PROBLEM:
Start with an integer n. If n is even, divide by 2. If n is odd, multiply by 3 and add 1. Repeat this process with the new value of n, terminating when n = 1. Given the input 22, the...
Is it possible to avoid the repetitions in the loop itself?
My program finds all the 4-digit vampire numbers.
There should be a total of only 7 numbers, but i'am getting 14.
How to remove the duplicates?
#include"stdafx.h"
#include<iostream>...
the compare predicate does not work.
Please tell me how to pass the comparison function.
#include"stdafx.h"
#include<queue>
#include<vector>
#include<string>
using namespace std;
bool...
By large inputs i mean strings with length at most 10^5 and also more than 100 queries both.
All the strings will only contain characters from A-Z, a-z and 0-9.( no spaces)
problem:
find the number of substrings of a string that contain some anagram of another string as a subsequence.
The substrings are considered different only if there start or end...
SOLVED! :)
the following program solved it . It ran fast for very large inputs.
Could you please look into the code and tell me how the algorithm works.
I don't completely understand this...
i changed my program to have bubble sort and a swap_flag. But it still runs slow for large inputs.Please help
#include <iostream>
#include <algorithm>
using namespace std;
int bubble_sorto...
I have a programming problem:
PROBLEM:
strings of only 'O' and 'Z' characters are given.
I have to calculate the minimum no. of changes so that all 'O's are
adjacent to each other and all 'Z's...
i have made Animal an abstract base class,
iam supposed to be able to create Dog, Cat and Snake objects,
but there is an error.
please help :(
#include"stdafx.h"
#include<iostream>...
for my following program i implemented a binary search function,
i was trying to compare the time taken for insertion and searching for an element by a vector and a multiset.
i called both find and...
the following code compiles :
#include<string>
typedef struct Node * NodePtr;
struct Node
{
std::string item;
Node * link;
};
when i'am giving elements for row 2 ,program crashes .it says access violation.i can't figure out the problem.please help :(
#include<iostream>
#include<vector>
#include<string>
using...
here is the range:
1<=N,M<=1000
i'am trying to solve a problem:
Given a string of N 0's and M 1's,how many unique permutations of this string start with 1?
answers for each test case is printed modulo(10^9 +7).
however my...
The program crashes.It says stack overflow.
Please help me make it right.
#include<iostream>
using namespace std;
static int grid[9][9];
void input();
void output();
void init();