2 solutions

  • 1
    @ 2024-5-22 20:15:52
    #include<bits/stdc++.h> 
    using namespace std;
     const int N=20;
     int a[N];
     int main() 
    { 
    	 int n; 
             cin>>n;	 	
             long long res; 	
             cin>>res; 	 
             for(int i=1;i<=n;i++) 
    	{ 
    		cin>>a[i]; 
    	} 
    	int x;
     	cin>>x;
     	for(int i=1;i<=n;i++)
     	{
     		res=res\*x+a[i];
     	}
     	cout<<res; 
    	return 0;
     }
    
    • 0
      @ 2024-5-22 20:14:14
      #include<bits/stdc++.h> using namespace std; const int N=20; int a[N]; int main() { 	 	int n; 	cin>>n;	 	long long res; 	cin>>res; 	for(int i=1;i<=n;i++) 	{ 		cin>>a[i]; 	} 	int x; 	cin>>x; 	for(int i=1;i<=n;i++) 	{ 		res=res\*x+a[i]; 	} 	cout<<res; 	return 0; }
      
      • 1

      Information

      ID
      175
      Time
      1000ms
      Memory
      256MiB
      Difficulty
      3
      Tags
      (None)
      # Submissions
      6
      Accepted
      3
      Uploaded By