Skip to content

Instantly share code, notes, and snippets.

@modos
Created March 15, 2023 07:59
Show Gist options
  • Save modos/5c28d2cc283fb41b99e5abcabd3fc919 to your computer and use it in GitHub Desktop.
Save modos/5c28d2cc283fb41b99e5abcabd3fc919 to your computer and use it in GitHub Desktop.
محاسبه‌ی پیچیده
/******************************************************************************
Online C++ Compiler.
Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile and execute it.
*******************************************************************************/
#include <iostream>
#include <math.h>
using namespace std;
int main()
{
int factorials[11] = {1,1,2,6, 24, 120, 720, 5040, 40320, 362880, 3628800};
int n;
int x;
int a;
int result;
cin >> a >> x >> n;
for (int i = 0; i <= n; i++) {
result += (factorials[n] / factorials[n - i] / factorials[i]) * pow(x, i) * pow(a, n - i);
}
cout << result;
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment