i couldn't understand why i am running m upto the dd[m]and dd[m-1] are not equal to 1 and at last in case of printing dd[n%m]..can anyone explain it to me??
#include <cstdio>
#include<iostream>
using namespace std;
long dd[1000000];
int main()
{
long long n;
long b, m;
long cases = 0;
while (1 ...
Search found 4 matches
- Fri May 30, 2014 6:32 am
- Forum: Volume 105 (10500-10599)
- Topic: 10518 - How Many Calls?
- Replies: 19
- Views: 17861
- Mon May 26, 2014 7:14 pm
- Forum: Volume 4 (400-499)
- Topic: 401 - Palindromes
- Replies: 196
- Views: 58203
why wa in uva-401??
#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<cctype>
using namespace std;
bool regular(string a)
{
int len = a.length();
bool flag = true;
for (int i = 0; i < len / 2; i++)
{
if (a.at(i) != a.at(len - i - 1))
{
flag = false;
break;
}
}
return flag ...
#include<cstdio>
#include<cstring>
#include<string>
#include<cctype>
using namespace std;
bool regular(string a)
{
int len = a.length();
bool flag = true;
for (int i = 0; i < len / 2; i++)
{
if (a.at(i) != a.at(len - i - 1))
{
flag = false;
break;
}
}
return flag ...
- Sun Aug 04, 2013 10:11 am
- Forum: Volume 109 (10900-10999)
- Topic: 10986 - Sending email
- Replies: 65
- Views: 39538
Re: 10986 - Sending email
above code give me TLE ..couldn't understand..
- Sun Aug 04, 2013 10:08 am
- Forum: Volume 109 (10900-10999)
- Topic: 10986 - Sending email
- Replies: 65
- Views: 39538
Re: 10986 - Sending email
#include<bits/stdc++.h>
using namespace std;
vector<int>g[20005];
int cost[20005][20005];
int d[20005];
struct node
{
int u,w;
node(int a,int b)
{
u=a;w=b;
}
bool operator < (const node& p)const
{
return w>p.w;
}
};
void reset()
{
for(int i=0;i<20005;i++)
g[i].clear();
}
int dijkstra(int ...
using namespace std;
vector<int>g[20005];
int cost[20005][20005];
int d[20005];
struct node
{
int u,w;
node(int a,int b)
{
u=a;w=b;
}
bool operator < (const node& p)const
{
return w>p.w;
}
};
void reset()
{
for(int i=0;i<20005;i++)
g[i].clear();
}
int dijkstra(int ...