题目来源:https://code.google.com/codejam/contest/dashboard?c=975485#s=p3
题目感觉非常不错,有思考的深度!
可以参考官方给出的解析:https://code.google.com/codejam/contest/dashboard?c=975485#s=a&a=3
#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;
int main()
{
int T, n, res, a, i, kcase = 1;
scanf("%d", &T);
while(T--)
{
scanf("%d", &n);
res = 0;
for(i = 1; i <= n; ++i)
{
scanf("%d", &a);
if(a != i)
res++;
}
printf("Case #%d: %d.000000\n", kcase++, res);
}
return 0;
}