• Home
  • About
    • changsoooooo's Blog photo

      changsoooooo's Blog

      changsoooooo's Blog.

    • Learn More
    • Twitter
    • Facebook
    • Instagram
    • Github
    • Steam
  • 일상
  • 교육
    • 교육학
    • 정보 컴퓨터 교육
    • 임용
  • 개발
  • 잡지식
  • 한국사
  • Projects

1267(휴대폰요금)

08 Nov 2020

Reading time ~1 minute

#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <math.h>
//휴대폰 요금 1267
using namespace std;
int main(){
	ios::sync_with_stdio(0); 
	cin.tie(0);
	
	int n;
	cin >> n;
	int m=0, y=0;
	for (size_t i = 0; i < n; i++)
	{
		int t;
		cin >> t;
		y += (t / 30) * 10;
		m += (t / 60) * 15;
		if (t % 30 != 29)
			y += 10;
		if (t % 60 != 59)
			m += 15;
	}
	if (y > m)
		cout << "M " << m;
	else if (m > y)
		cout << "Y " << y;
	else
		cout << "Y M " << y;
	
}


Share Tweet +1