Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int n,m;
- int main(){
- cin>>n>>m;
- if (n>m)
- swap(n,m);
- if (n==2 && m==2){
- cout<<4<<endl;
- return 0;
- }
- if (n==2 && m==3){
- cout<<4<<endl;
- return 0;
- }
- if (n==1 || m==1){
- cout<<n*m<<endl;
- return 0;
- }
- if ((n*m%2)==0)
- cout<<(n*m)/2<<endl;
- else
- cout<<(n*m)/2+1<<endl;
- return 0;
- }
Add Comment
Please, Sign In to add comment