Untitled
unknown
plain_text
2 years ago
393 B
6
Indexable
#define ll long long
class Solution {
public:
long long flowerGame(int n, int m) {
ll odd1=0,even1=0,even2=0,odd2=0;
for(int i=1;i<=n;i++){
if(i%2==0) even1++;
else odd1++;
}
for(int i=1;i<=m;i++){
if(i%2==0) even2++;
else odd2++;
}
ll sum=odd1*even2 + even1*odd2;
return sum;
}
};Editor is loading...
Leave a Comment