1 #include <iostream> 2 #include <vector> 3 4 int main() { 5 int x{}, m{}; 6 std::cin >> x >> m; 7 std::vector<std::vector<int>> nc(x+1,std::vector<int>(2,1));//nc是二维数组 ,第一列代表n数组,第二列代表c数组 x+1是为了方便使用c0将数组增加一行 8 std::vector<int> b(x + 1,0); 9 10 for (int i{1}; i <= x; i++) { 11 std::cin >> nc[i][0]; 12 nc[i][1] *= (nc[i][0] * nc[i - 1][1]); 13 14 b[i] = (m % nc[i][1]) / nc[i - 1][1]; 15 } 16 17 for (int i{ 1 }; i <= x; i++) { 18 std::cout << b[i] << ' '; 19 } 20 }
标签:std,int,nc,202209,C++,vector,数组,CSP From: https://www.cnblogs.com/n00b/p/16888673.html