# 反差萌

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 1161    Accepted Submission(s): 655

Problem Description

Input

1<=T<=10
1<=N<=1000
-1000<=Mi<=1000

Output

Sample Input

2
1 13 14
2 1 -2 0 3


Sample Output

1
6


#include <cstdio>
#include <iostream>
#include <algorithm>
using namespace std;

int a[10005];

int main()
{
int t,n;
int ans;
while(scanf("%d",&t) != EOF)
{
while(t--)
{
ans = 0;
scanf("%d",&n);
for(int i=0;i<2*n;i++)
{
scanf("%d",&a[i]);
}
sort(a,a+2*n);
/*
for(int i=0;i<2*n;i++)
{
printf("%d ",a[i]);
}
*/
for(int i=0;i<(2*n)/2;i++)
{
ans += fabs(a[2*n-i-1] - a[i]);
}
printf("%d\n",ans);
}
}
return 0;
}

# BigZhuGod的粉丝

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 1686    Accepted Submission(s): 678

Problem Description

Input

Output

^_^

Sample Input

5
I am BigZhuGod?
I am BigZhuGod.
I am BigZhuGod!
I am BigZhuGod!!!
I am BigZhuGod!!!!!


Sample Output

-_-
Orz
Wow!
Wooow!
Wooooow!


#include <cstdio>
#include <iostream>
#include <string>
using namespace std;

int main()
{
int n,count;
string s;
while(scanf("%d",&n) != EOF)
{
for(int i=0;i<n;i++)
{
cin >> s;
count = 0;
int len = s.length();
for(int i=0;i<len;i++)
{
if(s[i] == '?')
{
cout << "-_-" << endl;
}else if(s[i] == '.')
{
cout << "Orz" << endl;
}else {
if(s[i] == '!')
{
count ++;
}
}
}
if(count != 0)
{
cout << "W" ;
for(int i=0;i<count;i++)
{
cout << "o";
}
cout << "w!" << endl;
}

}
}
return 0;
}


# 递增数

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 921    Accepted Submission(s): 196

Problem Description

Input

Output

Sample Input

3
5
20
100


Sample Output

5
18
54


#include <cstdio>
#include <iostream>
using namespace std;

int cmt(int x)
{
int cnt = 0;
int a[2005];
while(x)
{
a[cnt++] = x % 10;
x /= 10;
}
int pre = a[cnt - 1];
for(int i=cnt-2;i>=0;i--)
{
if(pre <= a[i])
{
pre = a[i];
}else {
return 0;
}
}
return 1;
}

int main()
{
int n;
while(scanf("%d",&n) != EOF)
{
int sum = 0;
for(int i=1;i<=n;i++)
{
if(cmt(i))
{
//cout << i << " ";
sum ++;
}
}
//cout << endl;
//cout << "\$" << sum << endl;
cout << sum << endl;
}
return 0;
}


# 我要拿走你的蜡烛

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 1044    Accepted Submission(s): 206

Problem Description
Darkrai最近喜欢玩《炉石传说》，他在一局比赛中使用了吉安娜英雄，选择了冰法套牌。

Input

Output

Sample Input

1
1 6
Fire


Sample Output

Yes



#include <cstdio>
#include <iostream>
#include <map>
using namespace std;

map<string,int>p;

int main()
{
int t,n,m;
string s;
bool flag;
cin >> t;
while(t--)
{
flag = 0;
cin >> n >> m;
for(int i=0;i<n;i++)
{
cin >> s;
p[s]++;
}
for(int i=0;i<=10;i++)
{
for(int j=0;j<=10;j++)
{
for(int k=0;k<=10;k++)
{
for(int l=0;l<=10;l++)
{
if(i<=p["Dog"] && j<=p["Evolved"] && k<=p["Fire"] && l<=p["Ice"])
{
int sum = 0;
int temp = 1 * i + 2 * j;
sum = (6+temp)*k + (3+temp)*l;
if(sum >= m)
{
flag = 1;
break;
}
}
}
}
}
}
if(flag)
{
cout << "Yes" << endl;
}else {
cout << "No" << endl;
}
}
return 0;
}


12-24 40