time limit: 1 sspace limit: 128000 KBtitle level: Golden Gold SolvingView Run Results Title Description
Description
Qi Cirno (Ice Goblin) has the ability to control the air-conditioning. It is more dangerous to freeze a small thing in an instant than a normal goblin. had been releasing the air-conditioner around her always very cold.
Due to the following three points reason ...
- Qi Cirno's Fuca symbol "Icicle Fall"-easy of the bomb screen is enough stupid, as long as standing in front of her there is no play will touch you;
- Zun in "Red Devil Township" introduced her when she said she was a bit stupid;
- In the Zun release "Oriental Phantasmagoria Tomb" Introduction map, in the picture put the Qi Lulu in the position of ⑨, and with "⑨ idiot" simple take, from "⑨" and "idiot" became her alias ...
So Kiki Cirno got the nickname of "idiot".
One day, Kiki Cirno again 2 ...
She wrote n letters to be loaded into N envelopes, but all were wrong ... Now you want to know how many kinds of possibilities are wrong.
Enter a description input
Description
Number of letters and envelopes N.
outputs description output
Description
The number of possibilities to mount the error.
sample input to
sample
Input Example 1 2 |
Input Example 2 4 |
Sample output Sample
outputs
Output Example 1 1 |
Output Example 2 9 |
data
size & Hint
1≤n≤100
Code: (This problem applies the high-precision added to the equation solution, the code does not increase the precision operation)
#include <iostream>
#include <cstdio>
#include <cstring>
using namespace Std;
int n,f[110];
int dp (int i)
{
if (i==1) return f[1];
if (i==2) return f[2];
else return f[i]= (i-1) * (DP (I-1) +DP (i-2));
}
int main ()
{
scanf ("%d", &n);
F[1]=0;f[2]=1;
printf ("%d", DP (n));
return 0;
}
1697⑨ to write.