今天來解YKL02(UVA10783):Odd Sum
會給a和b,要output a到b之間基數的合
#include <iostream>
using namespace std;
int main(){
int casenum,num=1;
cin >> casenum;
while(num <= casenum){
int a,b,sum=0;
cin >> a >> b;
for(int i=a;i <= b;i++){
if(i%2==1){
sum+=i;
}
}
cout << "Case " << num << ": " << sum << endl;
num++;
}
return 0;
}