日历

2008 8.20 Wed
     12
3456789
10111213141516
17181920212223
24252627282930
31      
«» 2008 - 8 «»

文章搜索

日志文章

2007年11月03日 16:18:55

fzu 1001 Duplicate Pair

/*
Sample Input
2
1 1
4
1 2 3 2
Sample Output
1
2

Original: IBM Challenge 2004.1
*/
#include <iostream>
using namespace std;
int main()
{
int n;
while (scanf("%d", &n) != EOF) {
register int i, s = 0;
for (i = 1; i <= n; i++) {
  int val;
  scanf("%d", &val);
  s -= val;
  s += i;
}
printf("%u\n", n - s);
}
return 0;
}

Tags: fzu   acm  

类别: 程序设计 |  评论(1) |  浏览(563) |  收藏
1楼 [匿名]错了 2008年03月10日 22:13:51 Says:
错了
发表评论