This code does not run in vc++.
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
unsigned long long A,B,C;
unsigned long long Moves;
void MoveDisks(unsigned long long n, unsigned long long *peg1, unsigned long long *peg2)
{
Moves-=(unsigned long long)pow(2,n)-1;
*peg1-=n ...
Search found 9 matches
- Sat Feb 19, 2005 5:16 pm
- Forum: Volume 2 (200-299)
- Topic: 254 - Towers of Hanoi
- Replies: 39
- Views: 20556
- Fri Feb 18, 2005 12:08 pm
- Forum: Volume 5 (500-599)
- Topic: 548 - Tree
- Replies: 23
- Views: 14050
548 getting TLE
#include<cstdio>
#include<cstring>
#include<string>
#define max 400000
#define Inf 999999999
struct TreeNode
{
int key;
struct TreeNode *left;
struct TreeNode *right;
};
char s[max*5];
int InOrderPos[max];
int PostOrder[max];
TreeNode Tree;
int MinCost;
int MinLeaf;
TreeNode* Initialize ...
#include<cstring>
#include<string>
#define max 400000
#define Inf 999999999
struct TreeNode
{
int key;
struct TreeNode *left;
struct TreeNode *right;
};
char s[max*5];
int InOrderPos[max];
int PostOrder[max];
TreeNode Tree;
int MinCost;
int MinLeaf;
TreeNode* Initialize ...
- Fri Feb 11, 2005 5:05 pm
- Forum: Volume 4 (400-499)
- Topic: 492 - Pig-Latin
- Replies: 213
- Views: 49433
TLE!!!!!! Very Strange
Got TLE for 492-Pig-Latin
PLZ any body explain
For using getline(cin,string) it does not run in VC++ properly.
I have used MINGW.
//this program run only in mingw;
#include<iostream>
#include<string>
using std::string;
using std::cout;
using std::endl;
using std::cin;
using std::getline;
string ...
PLZ any body explain
For using getline(cin,string) it does not run in VC++ properly.
I have used MINGW.
//this program run only in mingw;
#include<iostream>
#include<string>
using std::string;
using std::cout;
using std::endl;
using std::cin;
using std::getline;
string ...
- Fri Feb 11, 2005 4:57 pm
- Forum: Volume 4 (400-499)
- Topic: 459 - Graph Connectivity
- Replies: 133
- Views: 57935
- Mon Jan 31, 2005 7:20 pm
- Forum: Volume 4 (400-499)
- Topic: 445 - Marvelous Mazes
- Replies: 93
- Views: 21931
Re: 445 WA;[
for c use gets(string) to get input.
if strlen(string)==0 than the input is a blank line;
for c++ use geline(cin,string)
if string.length()==0 than input is a blank line
if strlen(string)==0 than the input is a blank line;
for c++ use geline(cin,string)
if string.length()==0 than input is a blank line
- Mon Jan 31, 2005 8:10 am
- Forum: Volume 4 (400-499)
- Topic: 494 - Kindergarten Counting Game
- Replies: 119
- Views: 37252
494-Kindergarten Counting Game: got WA for such an easy one!
For using getlint(cin, ) it does not run properly in VC++
I used mingw.
I define a word as a consecutive sequence of charecter if its each charecter is a letter (upper/lower). Thats what i can do in computer.
I think the problem is there how I define words.
How can I know that a consecutive sequence ...
I used mingw.
I define a word as a consecutive sequence of charecter if its each charecter is a letter (upper/lower). Thats what i can do in computer.
I think the problem is there how I define words.
How can I know that a consecutive sequence ...
- Sun Jan 30, 2005 9:50 am
- Forum: Volume 4 (400-499)
- Topic: 484 - The Department of Redundancy Department
- Replies: 103
- Views: 20376
484-The Department of Redundancy Department: got WA !!!
PLZ HELP!!! :roll:
#include<cstdio>
#include<cstring>
#define max 90000000
char s[max];
int i[max];
int freq[max];
int n;
int main()
{
char *st;
int *f=freq+(max/2);
while(gets(s))
{
st=s;
n=0;
while(1)
{
while(*st==' ')st++;
if(*st=='\0')break;
sscanf(st,"%d",&i[n++]);
while(*st ...
#include<cstdio>
#include<cstring>
#define max 90000000
char s[max];
int i[max];
int freq[max];
int n;
int main()
{
char *st;
int *f=freq+(max/2);
while(gets(s))
{
st=s;
n=0;
while(1)
{
while(*st==' ')st++;
if(*st=='\0')break;
sscanf(st,"%d",&i[n++]);
while(*st ...
- Sun Jan 30, 2005 9:42 am
- Forum: Volume 4 (400-499)
- Topic: 492 - Pig-Latin
- Replies: 213
- Views: 49433
492-Pig-latin: plz find out the WA.
For using getline(cin,ip) this program does not run in vc++ properly.
I used mingw.
#include<iostream>
#include<string>
#include<cstring>
using std::string;
using std::cout;
using std::endl;
using std::cin;
using std::getline;
string ip;
string vowel("AEIOUaeiou");
int p1,p2;
int fsf;
int l ...
I used mingw.
#include<iostream>
#include<string>
#include<cstring>
using std::string;
using std::cout;
using std::endl;
using std::cin;
using std::getline;
string ip;
string vowel("AEIOUaeiou");
int p1,p2;
int fsf;
int l ...
- Sun Jan 30, 2005 5:57 am
- Forum: Volume 4 (400-499)
- Topic: 459 - Graph Connectivity
- Replies: 133
- Views: 57935
459-graph connectivity: got TLE (accepted)
How can I make this faster?
PLZ help.
#include<stdio.h>
#include<string.h>
#define max 100
int set[max];
int cc;
int rootof(int node)
{
while(set[node]>0) node=set[node];
return node;
}
void setunion(int pr,int cr)
{set[pr]+=set[cr]; set[cr]=pr;}
void disjointset(int v1, int v2)
{
int r1 ...
PLZ help.
#include<stdio.h>
#include<string.h>
#define max 100
int set[max];
int cc;
int rootof(int node)
{
while(set[node]>0) node=set[node];
return node;
}
void setunion(int pr,int cr)
{set[pr]+=set[cr]; set[cr]=pr;}
void disjointset(int v1, int v2)
{
int r1 ...