vakho

2011 - Episode I Problem B

Sep 25th, 2012
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.26 KB | None | 0 0
  1. #include <fstream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.     int ans(0), N(0), M(0);
  8.  
  9.     ifstream ifs("forcycle.in");
  10.     ifs >> N >> M;
  11.     ifs.close();
  12.    
  13.     for (int i = 1; i <= N; i++)
  14.         ans += (i % M);
  15.    
  16.     ofstream ofs("forcycle.out");
  17.     ofs << ans;
  18.     ofs.close();
  19. }
Advertisement
Add Comment
Please, Sign In to add comment