2 条题解

  • 1
    @ 2025-1-17 11:45:13
    #include<iostream>
    using namespace std;
    int main(){
    	long long x, n, a, b, sum = 0;
    	cin >> x >> n;
    	for (int i = 1; i <= n; i++){
    		cin >> a >> b;
    		long long p = 1;
    		for (int j = 1; j <= b; j++)
    			p = p * x;
    		sum = sum + a * p;
    	}
    	cout << sum;
    	return 0;
    }
    
    
    • 0
      @ 2024-10-27 9:16:36

      #include <iostream> using namespace std; int main(){ int x,n; cin >> x >> n; long long sum = 0; for(int i = 1; i <= n; i++) { int a,b; cin >> a >> b; long long cnt = 1; for(int j = 1; j <= b;j ++) { cnt *= x; } sum += a * cnt; } cout << sum; return 0;

      }

      • 1

      信息

      ID
      44
      时间
      1000ms
      内存
      256MiB
      难度
      6
      标签
      递交数
      269
      已通过
      83
      上传者