Search found 8 matches

by cOsMo
Tue Jun 21, 2005 9:09 pm
Forum: Algorithms
Topic: HELP: Factorials
Replies: 3
Views: 962

tnx

Thank you all. I totally misunderstood the problem.
by cOsMo
Thu Jun 16, 2005 2:45 pm
Forum: Algorithms
Topic: HELP: Factorials
Replies: 3
Views: 962

HELP: Factorials

I must find the last non zero digit of n! #include <cstdio> int find_last(int x) { while (x%10==0) x/=10; return x%10; } int fact(int x) { int sol=1; for (int i=1;i<=x;i++) sol=find_last(find_last(i)*find_last(sol)); return sol; } int main(void) { int n; scanf("%d",&n); printf("%d\n",fact(n)); retur...
by cOsMo
Sun Jun 12, 2005 2:41 pm
Forum: Volume 1 (100-199)
Topic: 147 - Dollars
Replies: 233
Views: 21238

tnx

It works...Tnx
by cOsMo
Thu Jun 09, 2005 6:40 pm
Forum: Volume 1 (100-199)
Topic: 147 - Dollars
Replies: 233
Views: 21238

I learned something new. You can't do this - float==something :D ,and I understand why you suggested EPS. Please PM the changed code so i can see what changes have you made...I was having MUCH trouble finding out my error, got tired and made BigNum -> got AC, so I think my error is not algorithmic. ...
by cOsMo
Thu Jun 09, 2005 2:08 pm
Forum: Volume 1 (100-199)
Topic: 147 - Dollars
Replies: 233
Views: 21238

Re: 147 __int64 can't hold big results.Please help

if (input<EPS) break; Program should stop if input<EPS...Why did you put "?" My program had wrong results after last coin was used.That was because my coins array was wrong. The correct one is: int coins[]={1, 2, 4, 10, 20, 40, 100, 200, 400, 1000, 2000 }; Finaly, my code was not accepted even with...
by cOsMo
Thu Jun 09, 2005 2:14 am
Forum: Volume 1 (100-199)
Topic: 147 - Dollars
Replies: 233
Views: 21238

Re: 147 __int64 can't hold big results.Please help

CODE REMOVED
by cOsMo
Wed Jun 08, 2005 1:22 am
Forum: Volume 1 (100-199)
Topic: 147 - Dollars
Replies: 233
Views: 21238

147 __int64 can't hold big results.Please help

CODE REMOVED
by cOsMo
Tue May 17, 2005 11:08 pm
Forum: Volume 6 (600-699)
Topic: 601 - The PATH
Replies: 20
Views: 8289

601 WHY TLE?

#include <cstdio> #include <string> #include <iostream> #define MAX 81 using namespace std; int dx[]={ 1,0,0,-1}; int dy[]={ 0,-1,1,0}; int bio[MAX][MAX]; char mat[MAX][MAX]; int n,sol=0; int ok(int x,int y) { if (x>=0 && x<n && y>=0 && y<n) return 1; return 0; } void dfs(int x,int y,int col,char c...

Go to advanced search