|
|
back to boardWhy WA on test #5? #include <conio.h> #include <stdio.h> #include <iostream> #include <string> using namespace std; int main(){ long long n; string s; cin>>n; cin>>s; int f=1; long long rez=n; int i=1; int k=s.size(); int zal = n % k; if (zal==0) { rez=rez*k; while (f==1){ if((n-i*k)>0){ rez=rez*(n-i*k); i=i+1; } else if ((n-i*k)<=0) { break; } } } else if (n%k!=0) { zal=n%k; rez=rez*zal; while (f==1){ if((n-i*k)!=zal){ rez=(n-i*k)*rez; i=i+1; } else if ((n-i*k)==zal) { break; } } } printf("%d",rez); return 0; } Where is my mistake? |
|
|