In this problem we must precalculate all possible factorials, and print them out when requested. Calculate factorials of 1 to 1000 takes so mush time. What is the good way to find them?
bignum f[1001];
int main(){
int n;
f[0] = bignum("1");
f[1] = bignum("1");
for (int i = 2; i <= 1000; i ...
Search found 6 matches
- Thu May 24, 2012 8:01 am
- Forum: Volume 6 (600-699)
- Topic: 623 - 500!
- Replies: 187
- Views: 71876
- Sun May 20, 2012 4:42 pm
- Forum: Volume 4 (400-499)
- Topic: 495 - Fibonacci Freeze
- Replies: 222
- Views: 60359
Re: 495 - Fibonacci Freeze
I got TL for this problem. My algorithm that find n'th fibonacci number is not fast. Can someone help me?
int main(){
int n;
while (cin >> n)
{
bignum a, b;
a = bignum(); // This means a = 0
b = bignum();
b.digits = 1;
b.a[0] = '1'; // This means b = 1
if (n == 0)
cout << "The Fibonacci ...
int main(){
int n;
while (cin >> n)
{
bignum a, b;
a = bignum(); // This means a = 0
b = bignum();
b.digits = 1;
b.a[0] = '1'; // This means b = 1
if (n == 0)
cout << "The Fibonacci ...
- Sun May 20, 2012 1:08 pm
- Forum: Volume 3 (300-399)
- Topic: 371 - Ackermann Functions
- Replies: 196
- Views: 51284
Re: 371 - Anckerman Functions
Thank you Brian...
- Sat May 19, 2012 9:56 pm
- Forum: Volume 3 (300-399)
- Topic: 371 - Ackermann Functions
- Replies: 196
- Views: 51284
Re: 371 - Anckerman Functions
Hello. I was wondering if you might be able to help me! Why I got RE for this problem? Here is my code:
Thank You
Code: Select all
Removed!
- Sat Mar 17, 2012 5:28 pm
- Forum: Volume 100 (10000-10099)
- Topic: 10038 - Jolly Jumpers
- Replies: 445
- Views: 153207
Re: 10038 - Jolly Jumpers
Can Someone help me?
What's the problem of this code??? :-/
#include <iostream>
using namespace std;
int main(){
int n;
while (cin >> n)
{
int m, j, d;
cin >> m;
bool jolly = true;
bool inc1 = false;
if (n > 1)
{
cin >> j;
d = max(j, m) - min(j, m);
if (d == n - 1)
inc1 = false ...
What's the problem of this code??? :-/
#include <iostream>
using namespace std;
int main(){
int n;
while (cin >> n)
{
int m, j, d;
cin >> m;
bool jolly = true;
bool inc1 = false;
if (n > 1)
{
cin >> j;
d = max(j, m) - min(j, m);
if (d == n - 1)
inc1 = false ...
- Tue Jan 03, 2012 6:33 pm
- Forum: Volume 2 (200-299)
- Topic: 272 - TEX Quotes
- Replies: 136
- Views: 56776
Re: 272 - TeX Quotes
Hi guys! What is the wrong of this code?
#include <iostream>
#include <cstring>
#include <string>
using namespace std;
string s;
void Shift(int i){
s += s[s.length() - 1];
for (int j = s.length() - 2; j > i; j--)
s[j + 1] = s[j];
}
int main(){
while (getline(cin, s))
{
if (s.length() > 0 ...
#include <iostream>
#include <cstring>
#include <string>
using namespace std;
string s;
void Shift(int i){
s += s[s.length() - 1];
for (int j = s.length() - 2; j > i; j--)
s[j + 1] = s[j];
}
int main(){
while (getline(cin, s))
{
if (s.length() > 0 ...