【2011 Greater New York Regional 】Problem B The Rascal Triangle

一个简单的规律题,每一列都是一个等差数列;

代码:

 1 #include<cstdio>
 2 #define ll long long
 3 using namespace std;
 4  
 5 int main()
 6 {
 7     int p;
 8     int ca=1;
 9     scanf("%d",&p);
10     while(p--)
11     {
12         int a,b;
13         scanf("%d",&ca);
14         scanf("%d%d",&a,&b);
15         ll ans=(a-b)*b+1;
16         printf("%d %lld\n",ca,ans);
17     }
18     return 0;
19 }
View Code

 

posted @ 2013-10-01 16:24  Yours1103  阅读(142)  评论(0编辑  收藏  举报