Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<fstream>
- #include<iostream>
- using namespace std;
- int main()
- {
- ifstream fi("SHOP.INP");
- ofstream fo("SHOP.OUT");
- int i, n, k, total = 0;
- fi>>n>>k;
- int a[n];
- for(i=0;i<n;i++)
- fi>>a[i];
- for(i=0;i<n;i++)
- if(!(i%(n/k)))
- total += a[i];
- fo<<"Gia tien "<<total<<endl;
- cout<<total<<endl;
- fi.close();
- fo.close();
- }
Advertisement
Add Comment
Please, Sign In to add comment