Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main(int argc, const char * argv[]) {
- ios_base::sync_with_stdio(false);
- int n, m;
- cin >> n >> m;
- int x;
- int red, yellow, green;
- red = 0;
- yellow = 0;
- green = 0;
- for(int i=0;i < n; i++){
- x = m;
- if(i % 3 == 0){
- red += (x+2)/3;
- x--;
- yellow += (x+2)/3;
- x--;
- green += (x + 2) / 3;
- }
- else if(i % 3 == 1){
- yellow += (x+2)/3;
- x--;
- green += (x + 2) / 3;
- x--;
- red += (x + 2) / 3;
- }
- else{
- green += (x + 2)/ 3;
- x--;
- red += (x + 2)/3;
- x--;
- yellow += (x + 2)/ 3;
- }
- }
- cout << red << " " << yellow << " " << green;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement