mirror of
https://git.sb/baoshuo/OI-codes.git
synced 2024-11-27 14:56:27 +00:00
804. n的阶乘
https://www.acwing.com/problem/content/submission/code_detail/14063689/
This commit is contained in:
parent
af3cb117d4
commit
567421d1c5
19
AcWing/804/804.cpp
Normal file
19
AcWing/804/804.cpp
Normal file
@ -0,0 +1,19 @@
|
||||
#include <iostream>
|
||||
|
||||
using std::cin;
|
||||
using std::cout;
|
||||
const char endl = '\n';
|
||||
|
||||
int n, res = 1;
|
||||
|
||||
int main() {
|
||||
std::ios::sync_with_stdio(false);
|
||||
|
||||
cin >> n;
|
||||
|
||||
while (res *= n--, n) {}
|
||||
|
||||
cout << res << endl;
|
||||
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue
Block a user