ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1083. Factorials!!!

qayerida xato gde awipka...?
Posted by Nargiza Asqarova 29 Nov 2011 19:26
var
   f,i:longint; k:1..20; n:1..10;
   s:string;
begin
   readln(n);
   read(s);
   f:=1;
   k:=length(s);
   for i:=0 to (n div k)-1 do begin
   f:=f*(n-i*k);  end;
   writeln(f); end.
Re: qayerida xato gde awipka...?
Posted by Sunnat 6 Dec 2011 21:05
Nargiza sizning xatoyingiz sonni va faktarialni ajratib olishda, va bundan tashqari hisoblash tsiklida n dan 1 ga tomon qadam k shaklida oling
Re: qayerida xato gde awipka...?
Posted by Zamira Ro`ziyeva 7 Dec 2011 00:44
ya'ni.....qanday
Re: qayerida xato gde awipka...?
Posted by DILSHOD7775 7 Dec 2011 14:03
hisoblash tsiklida n dan 1 ga tomon qadam k shaklida olinishi kerak
xatolik quyidagicha
Posted by Sunnat 7 Dec 2011 16:12
sizda menimcha kiritish jarayonida raqam(n) va undov(!) orasida probel(_) qo'ymasdan yozganda xato ishlashi mumkin. shunda undovlarni ham raqam sifatida o'qib s ni uzunligi 0 ga teng bo'lib qoladi. shuning uchun n/l(n bo'lingan s ning uzunligi) n/0 bo'lib qolyapti shunda sizga Crash (integer division by zero) ashibka beryapti
Re: qayerida xato gde awipka...?
Posted by Jo'rayeva Dildora 16 Jan 2012 23:40
Re: qayerida xato gde awipka...?
Posted by Djet 19 Jul 2013 01:41
#include <iostream>
using namespace std;
int main()
{
      int n,t,s;
      cin>>n;
      char k[20];
      gets(k);
      s=n;
      t=n%(strlen(k)-1);
      if(t!=0)
      while(n>t)
      { n=n-(strlen(k)-1);
          s*=n; }
      else
       while(n>(strlen(k)-1))
       { n=n-(strlen(k)-1);
          s*=n;
               }
       cout<<s<<endl;

return 0;
}