题解 UVA12004 【Bubble Sort】
Autism_ever · · 题解
思路:本题求冒泡排序的次数
所以
#include<bits/stdc++.h>//万能头
using namespace std;
int main()
{
int n;
cin>>n;
for(int i=1;i<=n;i++)//循环输入
{
int m;
cin>>m;
m=m*(m-1)/2;
if(k%2==0)cout<<"Case "<<i<<": "<<m/2<<endl;
else cout<<"Case "<<i<<": "<<m<<endl;//套公式
}
return 0;//完美结束
}