7-3 大笨钟 (10分)
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define N 100000
int a[N];
int main(){
int hour,minue;
scanf("%0d:%0d",&hour,&minue);
if(0<=hour&&12>=hour){
printf("Only %02d:%02d. Too early to Dang.",hour,minue);
}
else{
hour-=12;
if(minue){
hour+=1;
for(int i=0;i<hour;i++){
cout<<"Dang";
}
cout<<endl;
}
else{
for(int i=0;i<hour;i++){
cout<<"Dang";
}
cout<<endl;
}
}
}
7-10 人以群分 (25分)
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define N 100000
int a[N];
int main(){
int n;
cin>>n;
for(int i=0;i<n;i++){
cin>>a[i];
}
sort(a,a+n);
ll s1=0,s2=0;
int n1;
if(n%2==0){
int w=n;
w/=2;
n1=w;
for(int i=0,j=w;i<w;i++,j++){
s1+=a[i];
s2+=a[j];
}
}
else{
int w=n+1;
w/=2;
n1=w;
for(int i=0,j=w-1;j<n;i++,j++){
s1+=a[i];
s2+=a[j];
}
s1-=a[w-1];
}
cout<<"Outgoing #: "<<n1<<endl;
cout<<"Introverted #: "<<(n-n1)<<endl;
cout<<"Diff = "<<abs(s1-s2)<<endl;
}
7-8 稳赢 (15分)
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define N 100000
int a[N];
int main(){
string s;
int n;
cin>>n;
int count1=0;
while(cin>>s){
if(s=="End")return 0;
if(count1==n){
cout<<s<<endl;
count1=0;
}
else{
if(s=="JianDao"){
cout<<"ChuiZi"<<endl;
count1++;
}
if(s=="ChuiZi"){
cout<<"Bu"<<endl;
count1++;
}
if(s=="Bu"){
cout<<"JianDao"<<endl;
count1++;
}
}
}
}