https://www.devskill.com/CodingProblems/ViewProblem/370
#include<bits/stdc++.h>
using namespace std;
int main()
{
long long n,a;
cin>>n;
for(int i=1;i<=n;i++)
{
cin>>a;
cout<<"Case "<<i<<": ";
if(a%2==0)
{
cout<<(a/2)*(a/2)<<endl;
}
else{
cout<<(a/2)*((a/2)+1)<<endl;
}
}
return 0;
}
#include<bits/stdc++.h>
using namespace std;
int main()
{
long long n,a;
cin>>n;
for(int i=1;i<=n;i++)
{
cin>>a;
cout<<"Case "<<i<<": ";
if(a%2==0)
{
cout<<(a/2)*(a/2)<<endl;
}
else{
cout<<(a/2)*((a/2)+1)<<endl;
}
}
return 0;
}
No comments:
Post a Comment