|  | 
|  | 
| вернуться в форум | help me pls! Послано Levan  31 дек 2015 12:04what is wrong?
 #include <iostream>
 #include <cmath>
 #include <map>
 #include <vector>
 using namespace std;
 
 int main()
 {
 int n;
 string str;
 cin >> n >> str;
 
 int k = str.size();
 int i = 0;
 int sum = 1;
 if(n % k == 0)
 {
 while(i != n / k)
 {
 sum *= n - k * i;
 i++;
 }
 }
 else
 {
 while(i != n / k + 1)
 {
 sum *= n - k * i;
 i++;
 }
 sum *= n % k;
 }
 
 cout << sum << endl;
 
 return 0;
 }
 
 Edited by author 31.12.2015 12:38
Re: help me pls! It would be great if you stop searching telepathists and show error message.
 Is it compilation error? Add "#include <string>" line.
 Is it WA? Strange. Code looks working.
 Is it any another error? Show it.
Re: help me pls! Послано Levan  31 дек 2015 13:02WA #10Re: help me pls! Some people suppose n can be 20 so int is not enough for sum.Try to use long long sum.
Re: help me pls! Послано Levan  1 янв 2016 19:33WA #10Re: help me pls! Test:5 !!!
 answer 10, your answer 20
Re: help me pls! Послано Bu1bu1  13 мар 2021 01:325!!!here k=3,
 5 isn't divisible by 3
 so you have to multiply 5%3=2 with 5*(5-3)
 so the answer is 5*2*2=20
 | 
 | 
|