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!!!

Can you check out what's wrong here ? (c++)
Posted by Said707 28 Jan 2018 23:08
#include <bits/stdc++.h>
using namespace std;
int main(){
int n, sana,s;
char k[21];
cin>>n;
cin.getline(k,sizeof(k));
sana = strlen(k)-1;

if (1<=n&&n<=10&&1<=sana&&sana<=20){

if(n%sana==0) { s=sana;}
else          { s=1;}
while(n>0){
    s*=n;
    n=n-sana;}
cout << s << endl;
}
}

Edited by author 28.01.2018 23:09