Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* e156 - 3 */
- /* AC (2ms, 100KB) */
- #include <cstdio>
- using namespace std;
- unsigned int n;
- typedef unsigned int (*fun)(unsigned int);
- unsigned int Solution_Teminator(unsigned n)
- {
- return 0;
- }
- unsigned int Sum_Solution(unsigned int n)
- {
- static fun f[2] = {Solution_Teminator, Sum_Solution};
- return n + f[!!n](n - 1);
- }
- int main()
- {
- scanf("%u", &n);
- printf("%u", Sum_Solution(n));
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment