31、到底是不是太胖了
# include <iostream>
# include <cmath>
using namespace std;
int m;
void check ( int h, float w)
{
float ww= ( h- 100 ) * 0.9 ;
if ( abs ( ww- w) < ( ww* 0.1 ) ) {
cout<< "You are wan mei!" << endl;
return ; }
if ( ( w- ww) >= ( ww* 0.1 ) ) {
cout<< "You are tai pang le!" << endl;
return ; }
if ( ( ww- w) >= ( ww* 0.1 ) ) {
cout<< "You are tai shou le!" << endl;
return ; }
}
int main ( )
{
cin>> m;
while ( m-- )
{
int h, w;
cin>> h>> w;
check ( h, w/ 2.0 ) ;
}
return 0 ;
}
32、Left-pad
# include <iostream>
# include <string>
using namespace std;
int n;
char c;
string str;
int main ( )
{
scanf ( "%d %c" , & n, & c) ;
getchar ( ) ;
getline ( cin, str) ;
if ( n== str. size ( ) )
{
cout<< str<< endl;
}
if ( n< str. size ( ) )
{
for ( int i= str. size ( ) - n; i< str. size ( ) ; i++ )
cout<< str[ i] ;
cout<< endl;
}
if ( n> str. size ( ) )
{
for ( int i= 1 ; i<= ( n- str. size ( ) ) ; i++ )
cout<< c;
for ( int i= 0 ; i< str. size ( ) ; i++ )
cout<< str[ i] ;
cout<< endl;
}
return 0 ;
}
33、出生年
# include <iostream>
# include <string.h>
# include <set>
using namespace std;
int main ( )
{
int y, n;
cin>> y>> n;
int ans= 0 ;
set< int > ms;
for ( int i= y; i< 3020 ; i++ )
{
ms. clear ( ) ;
int num= i;
for ( int j= 0 ; j< 4 ; j++ )
{
ms. insert ( num% 10 ) ;
num/= 10 ;
}
if ( ms. size ( ) == n) {
printf ( "%d %04d\n" , ans, i) ;
break ; }
ans++ ;
}
return 0 ;
}
34、点赞
# include <iostream>
# include <vector>
# include <algorithm>
using namespace std;
int n;
vector< int > mv;
bool bv[ 1010 ] ;
int main ( )
{
cin>> n;
for ( int i= 1 ; i<= n; i++ )
{
int k= 0 , ret= 0 ;
cin>> k;
for ( int j= 1 ; j<= k; j++ ) {
cin>> ret;
mv. push_back ( ret) ;
}
}
int mmax= - 1 , ans= 0 ;
for ( int i= mv. size ( ) - 1 ; i>= 0 ; i-- )
{
int sum= 0 ;
if ( bv[ mv[ i] ] == 0 ) {
for ( int q= 0 ; q< mv. size ( ) ; q++ )
if ( mv[ q] == mv[ i] )
sum++ ;
if ( sum> mmax)
{
ans= mv[ i] ;
mmax= sum;
}
bv[ mv[ i] ] = 1 ;
}
}
cout<< ans<< " " << mmax<< endl;
return 0 ;
}
35、情人节
# include <iostream>
# include <vector>
# include <string>
using namespace std;
vector< string> mv;
int main ( )
{
string str;
while ( 1 ) {
str. clear ( ) ;
cin>> str;
if ( str[ 0 ] == '.' )
break ;
mv. push_back ( str) ;
}
if ( mv. size ( ) >= 14 ) {
cout<< mv[ 1 ] << " and " << mv[ 13 ] << " are inviting you to dinner..." << endl;
return 0 ;
}
if ( mv. size ( ) >= 2 && mv. size ( ) < 13 ) {
cout<< mv[ 1 ] << " is the only one for you..." << endl;
return 0 ;
}
if ( mv. size ( ) < 2 ) {
cout<< "Momo... No one is for you ..." << endl;
}
return 0 ;
}
36、A乘以B
# include <iostream>
using namespace std;
int main ( )
{
int a, b;
cin>> a>> b;
cout<< a* b<< endl;
}
37、A除以B
# include <iostream>
using namespace std;
int main ( )
{
int a, b;
cin>> a>> b;
if ( b== 0 )
printf ( "%d/0=Error\n" , a) ;
if ( b> 0 )
printf ( "%d/%d=%.2f\n" , a, b, a/ ( b* 1.0 ) ) ;
if ( b< 0 )
printf ( "%d/(%d)=%.2f\n" , a, b, a/ ( b* 1.0 ) ) ;
return 0 ;
}
38、新世界
# include <stdio.h>
int main ( )
{
printf ( "Hello World\nHello New World\n" ) ;
return 0 ;
}
39、古风排版
# include <iostream>
# include <string>
# include <algorithm>
using namespace std;
int main ( )
{
int n, col;
cin>> n;
getchar ( ) ;
string str;
getline ( cin, str) ;
if ( str. size ( ) % n== 0 )
col= str. size ( ) / n;
else {
col= str. size ( ) / n+ 1 ;
for ( int i= 0 ; i< str. size ( ) % n; i++ )
str+= ' ' ;
}
string arr[ col] ;
for ( int i= 0 ; i< col; i++ ) {
string temp;
for ( int j= i* n; j< i* n+ n; j++ )
temp+= str[ j] ;
arr[ i] = temp;
}
for ( int i= 0 ; i< n; i++ ) {
for ( int j= col- 1 ; j>= 0 ; j-- )
cout<< arr[ j] [ i] ;
cout<< endl;
}
return 0 ;
}
40、最佳情侣身高差
# include <iostream>
using namespace std;
int main ( )
{
int n;
cin>> n;
while ( n-- )
{
char op[ 2 ] ;
float h;
cin>> op>> h;
if ( * op== 'F' ) {
printf ( "%.2f\n" , h* 1.09 ) ;
}
else if ( * op== 'M' ) {
printf ( "%.2f\n" , h/ 1.09 ) ;
}
}
return 0 ;
}
41、寻找250
# include <iostream>
using namespace std;
int main ( )
{
int n;
int i= 1 ;
while ( cin>> n) {
if ( n== 250 )
break ;
i++ ;
}
cout<< i<< endl;
return 0 ;
}
42、日期格式化
# include <iostream>
using namespace std;
int main ( )
{
int yy, mm, dd;
scanf ( "%d-%d-%d" , & mm, & dd, & yy) ;
printf ( "%d-%02d-%02d\n" , yy, mm, dd) ;
return 0 ;
}
43、阅览室
# include <stdio.h>
typedef struct Book
{
int wasBorrow;
char operate;
int hour;
int min;
} Book;
int main ( void )
{
int days, count, times, id;
id = days = count = times = 0 ;
Book records[ 1005 ] , temp;
scanf ( "%d" , & days) ;
while ( days-- )
{
while ( 1 )
{
scanf ( "%d %c %d:%d" , & id, & temp. operate, & temp. hour, & temp. min) ;
if ( 0 == id)
break ;
else if ( 'E' == temp. operate)
{
if ( records[ id] . wasBorrow == 1 )
{
count++ ;
times += ( temp. hour - records[ id] . hour) * 60 + temp. min - records[ id] . min;
records[ id] . wasBorrow = 0 ;
}
}
else if ( 'S' == temp. operate)
{
records[ id] = temp;
records[ id] . wasBorrow = 1 ;
}
}
if ( 0 == count)
printf ( "0 0\n" ) ;
else
printf ( "%d %d\n" , count, ( int ) ( ( double ) times/ count+ 0.5 ) ) ;
count = times = 0 ;
for ( int i = 0 ; i < 1005 ; i++ )
records[ i] . wasBorrow = 0 ;
}
return 0 ;
}
44、稳赢
# include <iostream>
# include <string>
using namespace std;
int main ( )
{
string str;
int n;
cin>> n;
while ( 1 )
{
for ( int i= 1 ; i<= n+ 1 ; i++ ) {
cin>> str;
if ( str== "End" )
return 0 ;
if ( i== n+ 1 ) {
cout<< str<< endl;
continue ; }
if ( str== "ChuiZi" )
cout<< "Bu" << endl;
if ( str== "Bu" )
cout<< "JianDao" << endl;
if ( str== "JianDao" )
cout<< "ChuiZi" << endl;
}
}
return 0 ;
}
45、宇宙无敌打招呼
# include <iostream>
# include <string>
using namespace std;
int main ( )
{
string str;
cin>> str;
cout<< "Hello " << str<< endl;
return 0 ;
}
46、整除光棍
# include <iostream>
# include <string>
# include <sstream>
using namespace std;
int arr[ 10 ] ;
int main ( )
{
int x;
cin>> x;
int s= 0 , n= 0 ;
while ( s< x) {
s= s* 10 + 1 ;
n++ ;
}
while ( 1 ) {
printf ( "%d" , s / x) ;
s %= x;
if ( s == 0 ) break ;
s = s * 10 + 1 ;
++ n;
}
printf ( " %d\n" , n) ;
return 0 ;
}
47、装睡
# include <iostream>
using namespace std;
int main ( )
{
int n;
cin>> n;
while ( n-- ) {
string id;
int h, m;
cin>> id>> h>> m;
if ( ( h< 15 || h> 20 )
|| ( m< 50 || m> 70 )
|| ( ( h< 15 || h> 20 ) && ( m< 50 || m> 70 ) )
)
cout<< id<< endl;
}
return 0 ;
}
48、矩阵A乘以B
# include <iostream>
using namespace std;
int a[ 101 ] [ 101 ] ;
int b[ 101 ] [ 101 ] ;
int c[ 101 ] [ 101 ] ;
int main ( )
{
int x, y;
int i, j;
cin>> x>> y;
for ( i= 1 ; i<= x; i++ )
for ( j= 1 ; j<= y; j++ )
cin>> a[ i] [ j] ;
int x2, y2;
cin>> x2>> y2;
for ( i= 1 ; i<= x2; i++ )
for ( j= 1 ; j<= y2; j++ )
cin>> b[ i] [ j] ;
if ( y!= x2) {
printf ( "Error: %d != %d" , y, x2) ;
return 0 ;
}
for ( i= 1 ; i<= x; i++ )
for ( j= 1 ; j<= y2; j++ )
{
int sum= 0 ;
for ( int k= 1 ; k<= y; k++ )
sum+= a[ i] [ k] * b[ k] [ j] ;
c[ i] [ j] = sum;
}
cout<< x<< " " << y2<< endl;
for ( i= 1 ; i<= x; i++ ) {
for ( j= 1 ; j<= y2; j++ ) {
if ( j== y2) {
cout<< c[ i] [ j] ;
continue ;
}
cout<< c[ i] [ j] << " " ;
}
cout<< endl;
}
return 0 ;
}
49、天梯赛座位分配
# include <iostream>
using namespace std;
struct School
{
int num;
int arr[ 1010 ] ;
} ;
int main ( )
{
int n, i, j;
cin>> n;
School sc[ 101 ] ;
for ( i= 1 ; i<= n; i++ )
cin>> sc[ i] . num;
int mmax= sc[ 1 ] . num* 10 ;
for ( j= 2 ; j<= n; j++ )
if ( sc[ j] . num> sc[ 1 ] . num)
mmax= sc[ j] . num* 10 ;
int ans= 1 ;
for ( i= 1 ; i<= mmax; i++ ) {
for ( j= 1 ; j<= n; j++ ) {
if ( sc[ j] . num* 10 < i) continue ;
sc[ j] . arr[ i] = ans++ ;
if ( i!= 1 && sc[ j] . arr[ i- 1 ] + 1 == sc[ j] . arr[ i] ) {
ans++ ;
sc[ j] . arr[ i] ++ ;
}
}
}
for ( i= 1 ; i<= n; i++ ) {
printf ( "#%d\n" , i) ;
for ( j= 1 ; j<= sc[ i] . num* 10 ; j++ ) {
cout<< sc[ i] . arr[ j] ;
if ( j% 10 != 0 )
cout<< " " ;
else
cout<< endl;
}
}
return 0 ;
}
50、倒数第N个字符串
# include <iostream>
# include <cmath>
using namespace std;
int main ( )
{
int l, n;
cin>> l>> n;
int ret= pow ( 26 , l) - n;
char a[ 7 ] ;
for ( int i= l- 1 ; i>= 0 ; i-- ) {
a[ i] = 'a' + ret% 26 ;
ret/= 26 ;
}
for ( int i= 0 ; i< l; i++ )
cout<< a[ i] ;
cout<< endl;
return 0 ;
}
51、打折
# include <iostream>
using namespace std;
int main ( )
{
int a, b;
cin>> a>> b;
printf ( "%.2f\n" , a* ( b* 1.0 / 10 ) ) ;
return 0 ;
}
52、2018我们要赢
# include <iostream>
using namespace std;
int main ( )
{
cout<< "2018" << endl<< "wo3 men2 yao4 ying2 !" << endl;
return 0 ;
}
53、电子汪
# include <iostream>
using namespace std;
int main ( )
{
int a, b;
cin>> a>> b;
int c= a+ b;
while ( c-- ) {
cout<< "Wang!" ;
}
cout<< endl;
return 0 ;
}
54、福到了
# include <iostream>
using namespace std;
char arr[ 101 ] [ 101 ] ;
char brr[ 101 ] [ 101 ] ;
int main ( )
{
int n;
char c;
cin>> c>> n;
getchar ( ) ;
for ( int i= 1 ; i<= n; i++ ) {
for ( int j= 1 ; j<= n; j++ )
scanf ( "%c" , & arr[ i] [ j] ) ;
getchar ( ) ;
}
for ( int i= 1 ; i<= n; i++ ) {
for ( int j= 1 ; j<= n; j++ )
if ( arr[ n- i+ 1 ] [ n- j+ 1 ] == ' ' )
brr[ i] [ j] = ' ' ;
else
brr[ i] [ j] = c;
}
int flag= 0 ;
for ( int i= 1 ; i<= n; i++ )
for ( int j= 1 ; j<= n; j++ )
if ( ( arr[ i] [ j] == ' ' && brr[ i] [ j] != ' ' ) || ( arr[ i] [ j] != ' ' && brr[ i] [ j] == ' ' ) )
{
flag= 1 ;
break ;
}
if ( flag== 0 )
cout<< "bu yong dao le" << endl;
for ( int i= 1 ; i<= n; i++ ) {
for ( int j= 1 ; j<= n; j++ )
cout<< brr[ i] [ j] ;
cout<< endl;
}
return 0 ;
}
55、谁是赢家
# include <iostream>
using namespace std;
int main ( )
{
int pa, pb, t;
int arr[ 2 ] = { 0 } ;
cin>> pa>> pb;
for ( int i= 1 ; i<= 3 ; i++ ) {
cin>> t;
arr[ t] ++ ;
}
if ( pa> pb) {
if ( arr[ 0 ] >= 1 )
printf ( "The winner is a: %d + %d\n" , pa, arr[ 0 ] ) ;
}
else
if ( arr[ 0 ] == 3 )
printf ( "The winner is a: %d + 3\n" , pa) ;
if ( pb> pa) {
if ( arr[ 1 ] >= 1 )
printf ( "The winner is b: %d + %d\n" , pb, arr[ 1 ] ) ;
}
else
if ( arr[ 1 ] == 3 )
printf ( "The winner is b: %d + 3\n" , pb) ;
return 0 ;
}
56、猜数字
# include <iostream>
# include <string>
# include <vector>
using namespace std;
int main ( )
{
int n;
vector< pair< string, int > > mv;
cin>> n;
string str;
int t;
for ( int i= 1 ; i<= n; i++ ) {
cin>> str>> t;
mv. push_back ( make_pair ( str, t) ) ;
}
int sum= 0 ;
for ( int i= 0 ; i< mv. size ( ) ; i++ )
sum+= mv[ i] . second;
sum= sum/ ( 2 * n) ;
int ret= 0 ;
int ans= abs ( mv[ 0 ] . second- sum) ;
for ( int i= 1 ; i< mv. size ( ) ; i++ )
if ( abs ( mv[ i] . second- sum) < ans) {
ret= i;
ans= abs ( mv[ i] . second- sum) ;
}
cout<< sum<< " " << mv[ ret] . first<< endl;
return 0 ;
}
57、PTA使我精神焕发
# include <iostream>
using namespace std;
int main ( )
{
cout<< "PTA shi3 wo3 jing1 shen2 huan4 fa1 !" << endl;
return 0 ;
}
58、6翻了
# include <iostream>
# include <string>
using namespace std;
int main ( )
{
string str;
getline ( cin, str) ;
int i= 0 , cnt= 0 ;
int l= str. size ( ) ;
while ( i< l) {
if ( str[ i] != '6' )
cout<< str[ i++ ] ;
else {
for ( cnt= 0 ; i< l&& str[ i] == '6' ; i++ , cnt++ ) ;
if ( cnt> 9 ) cout<< 27 ;
else if ( cnt> 3 ) cout<< 9 ;
else while ( cnt-- > 0 ) cout<< 6 ;
}
}
return 0 ;
}
59、敲笨钟
# include <iostream>
# include <vector>
# include <string>
using namespace std;
int main ( )
{
int n, i, j;
cin>> n;
string arr[ 21 ] ;
getchar ( ) ;
for ( i= 0 ; i< n; i++ )
getline ( cin, arr[ i] ) ;
for ( i= 0 ; i< n; i++ ) {
int flag= 0 ;
for ( j= 0 ; j< arr[ i] . size ( ) ; j++ ) {
if ( arr[ i] [ j] == ',' && arr[ i] [ j- 1 ] == 'g' && arr[ i] [ j- 2 ] == 'n' && arr[ i] [ j- 3 ] == 'o' )
flag++ ;
if ( arr[ i] [ j] == '.' && arr[ i] [ j- 1 ] == 'g' && arr[ i] [ j- 2 ] == 'n' && arr[ i] [ j- 3 ] == 'o' )
flag++ ;
}
if ( flag< 2 ) {
cout<< "Skipped" << endl;
continue ;
}
int cnt= 0 ;
for ( j= arr[ i] . size ( ) ; j> 0 ; j-- ) {
if ( arr[ i] [ j] == ' ' )
cnt++ ;
if ( cnt== 3 )
break ;
}
for ( int k= 0 ; k<= j; k++ )
cout<< arr[ i] [ k] ;
cout<< "qiao ben zhong." << endl;
}
return 0 ;
}
60、心理阴影面积
# include <iostream>
using namespace std;
int main ( )
{
int x, y;
cin>> x>> y;
cout<< 5000 - ( 100 * y) / 2 - ( 100 * ( 100 - x) ) / 2 << endl;
return 0 ;
}
61、新胖子公式
# include <iostream>
# include <cmath>
using namespace std;
int main ( )
{
float hh, ww;
cin>> ww>> hh;
float ret= ww/ ( pow ( hh, 2 ) ) ;
printf ( "%.1f\n" , ret) ;
if ( ret> 25 )
cout<< "PANG" << endl;
else
cout<< "Hai Xing" << endl;
return 0 ;
}
62、幸运彩票
# include <iostream>
# include <string>
using namespace std;
int main ( )
{
int n;
cin>> n;
while ( n-- ) {
string str;
cin>> str;
if ( str[ 0 ] + str[ 1 ] + str[ 2 ] == str[ 3 ] + str[ 4 ] + str[ 5 ] )
cout<< "You are lucky!" << endl;
else
cout<< "Wish you good luck." << endl;
}
return 0 ;
}
63、吃鱼还是吃肉
# include <iostream>
using namespace std;
int main ( )
{
int n, ss, hh, ww;
cin>> n;
while ( n-- ) {
cin>> ss>> hh>> ww;
if ( ss== 0 ) {
if ( hh< 129 )
cout<< "duo chi yu! " ;
if ( hh> 129 )
cout<< "ni li hai! " ;
if ( hh== 129 )
cout<< "wan mei! " ;
if ( ww< 25 )
cout<< "duo chi rou!" << endl;
if ( ww> 25 )
cout<< "shao chi rou!" << endl;
if ( ww== 25 )
cout<< "wan mei!" << endl;
}
else if ( ss== 1 ) {
if ( hh< 130 )
cout<< "duo chi yu! " ;
if ( hh> 130 )
cout<< "ni li hai! " ;
if ( hh== 130 )
cout<< "wan mei! " ;
if ( ww< 27 )
cout<< "duo chi rou!" << endl;
if ( ww> 27 )
cout<< "shao chi rou!" << endl;
if ( ww== 27 )
cout<< "wan mei!" << endl;
}
}
return 0 ;
}
64、估值一亿的AI核心代码
# include <iostream>
# include <string>
using namespace std;
string a, b;
int main ( )
{
int n;
cin>> n;
getchar ( ) ;
while ( n-- ) {
getline ( cin, a) ;
int l= a. length ( ) ;
cout<< a<< endl;
b= "" ;
int i= 0 ;
while ( i< l&& a[ i] == ' ' ) a. erase ( i, 1 ) ;
l= a. length ( ) ;
while ( i< l) {
if ( a[ i] >= 'A' && a[ i] <= 'Z' && a[ i] != 'I' ) a[ i] += 32 ;
if ( a[ i] == '?' ) a[ i] = '!' ;
i++ ;
}
i= 0 ;
while ( i< l) {
if ( a[ i] == ' ' ) {
if ( ! ( a[ i+ 1 ] >= '0' && a[ i+ 1 ] <= '9' ) && a[ i+ 1 ] != 'I' && ( a[ i+ 1 ] < 'a' || a[ i+ 1 ] > 'z' ) ) a. erase ( i, 1 ) ;
while ( a[ i+ 1 ] == ' ' ) a. erase ( i+ 1 , 1 ) ;
}
i++ ;
}
i= a. length ( ) - 1 ;
while ( a[ i] == ' ' && i) {
a. erase ( i, 1 ) ;
i-- ;
}
i= 0 ;
l= a. length ( ) ;
while ( i< l) {
if ( a[ i] == ' ' ) {
if ( ( ( a[ i- 1 ] >= '0' && a[ i- 1 ] <= '9' ) || a[ i- 1 ] == 'I' || a[ i- 1 ] >= 'a' && a[ i- 1 ] <= 'z' ) && ( ! ( a[ i+ 1 ] >= '0' && a[ i+ 1 ] <= '9' ) && a[ i+ 1 ] != 'I' && ( a[ i+ 1 ] < 'a' || a[ i+ 1 ] > 'z' ) ) )
a. erase ( i, 1 ) ;
}
i++ ;
}
i= 0 ;
l= a. length ( ) ;
while ( i< l) {
if ( ( ! ( a[ i- 1 ] >= '0' && a[ i- 1 ] <= '9' ) && a[ i- 1 ] != 'I' && ( a[ i- 1 ] < 'a' || a[ i- 1 ] > 'z' ) ) ) {
if ( a[ i] == 'c' && a[ i+ 1 ] == 'a' && a[ i+ 2 ] == 'n' && a[ i+ 3 ] == ' ' && a[ i+ 4 ] == 'y' && a[ i+ 5 ] == 'o' && a[ i+ 6 ] == 'u' && ( ! ( a[ i+ 7 ] >= '0' && a[ i+ 7 ] <= '9' ) && a[ i+ 7 ] != 'I' && ( a[ i+ 7 ] < 'a' || a[ i+ 7 ] > 'z' ) ) ) {
b+= "I can" ;
i+= 7 ;
}
else if ( a[ i] == 'c' && a[ i+ 1 ] == 'o' && a[ i+ 2 ] == 'u' && a[ i+ 3 ] == 'l' && a[ i+ 4 ] == 'd' && a[ i+ 5 ] == ' ' && a[ i+ 6 ] == 'y' && a[ i+ 7 ] == 'o' && a[ i+ 8 ] == 'u' && a[ i+ 9 ] != 'I' && ( ! ( a[ i+ 9 ] >= '0' && a[ i+ 9 ] <= '9' ) && ( a[ i+ 9 ] < 'a' || a[ i+ 9 ] > 'z' ) ) ) {
b+= "I could" ;
i+= 9 ;
}
else if ( a[ i] == 'I' && ( ! ( a[ i+ 1 ] >= '0' && a[ i+ 1 ] <= '9' ) && a[ i+ 1 ] != 'I' && a[ i+ 1 ] != 'I' && ( a[ i+ 1 ] < 'a' || a[ i+ 1 ] > 'z' ) ) ) {
b+= "you" ;
i++ ;
}
else if ( a[ i] == 'm' && a[ i+ 1 ] == 'e' && ( ! ( a[ i+ 2 ] >= '0' && a[ i+ 2 ] <= '9' ) && a[ i+ 2 ] != 'I' && ( a[ i+ 2 ] < 'a' || a[ i+ 2 ] > 'z' ) ) ) {
b+= "you" ;
i+= 2 ;
}
else {
b+= a[ i] ;
i++ ;
}
}
else {
b+= a[ i] ;
i++ ;
}
}
cout<< "AI: " << b<< endl;
}
return 0 ;
}
65、甭废话上代码
# include <iostream>
using namespace std;
int main ( )
{
cout<< "Talk is cheap. Show me the code." << endl;
return 0 ;
}
66、猫是液体
# include <iostream>
using namespace std;
int main ( )
{
int cc, kk, gg;
cin>> cc>> kk>> gg;
cout<< cc* kk* gg<< endl;
return 0 ;
}
67、洛希极限
# include <iostream>
using namespace std;
int main ( )
{
float a, b, d;
int c;
cin>> a>> c>> b;
if ( c== 0 )
d= a* 2.455 ;
else if ( c== 1 )
d= a* 1.26 ;
printf ( "%.2f " , d) ;
if ( b< d)
cout<< "T_T" << endl;
else if ( b> d)
cout<< "^_^" << endl;
return 0 ;
}
68、调和平均
# include <iostream>
using namespace std;
int main ( )
{
int n;
float ans;
cin>> n;
for ( int i= 1 ; i<= n; i++ ) {
float ret;
cin>> ret;
ans= ans+ 1.0 / ret;
}
printf ( "%.2f\n" , 1 / ( ans/ n) ) ;
return 0 ;
}
69、胎压监测
# include <iostream>
# include <algorithm>
using namespace std;
int main ( )
{
int t1, t2, t3, t4, mmin, ret;
cin>> t1>> t2>> t3>> t4>> mmin>> ret;
int mmax;
mmax= max ( t1, t2) ;
mmax= max ( mmax, t3) ;
mmax= max ( mmax, t4) ;
if ( t1>= mmin&& t2>= mmin&& t3>= mmin&& t4>= mmin
&& ( mmax- t1<= ret) && ( mmax- t2<= ret) && ( mmax- t3<= ret) && ( mmax- t4<= ret) ) {
cout<< "Normal" << endl;
return 0 ; }
if ( ( mmax- t1> ret|| t1< mmin) && t2>= mmin&& t3>= mmin&& t4>= mmin
&& ( mmax- t2<= ret) && ( mmax- t3<= ret) && ( mmax- t4<= ret) ) {
printf ( "Warning: please check #%d!" , 1 ) ;
return 0 ; }
if ( ( mmax- t2> ret|| t2< mmin) && t1>= mmin&& t3>= mmin&& t4>= mmin
&& ( mmax- t1<= ret) && ( mmax- t3<= ret) && ( mmax- t4<= ret) ) {
printf ( "Warning: please check #%d!" , 2 ) ;
return 0 ; }
if ( ( mmax- t3> ret|| t3< mmin) && t1>= mmin&& t2>= mmin&& t4>= mmin
&& ( mmax- t1<= ret) && ( mmax- t2<= ret) && ( mmax- t4<= ret) ) {
printf ( "Warning: please check #%d!" , 3 ) ;
return 0 ; }
if ( ( mmax- t4> ret|| t4< mmin) && t1>= mmin&& t2>= mmin&& t3>= mmin
&& ( mmax- t1<= ret) && ( mmax- t2<= ret) && ( mmax- t3<= ret) ) {
printf ( "Warning: please check #%d!" , 4 ) ;
return 0 ; }
cout<< "Warning: please check all the tires!" << endl;
return 0 ;
}
70、吃火锅
# include <iostream>
# include <string>
# include <algorithm>
using namespace std;
int main ( )
{
string str;
int i= 0 , j= 0 , k= 0 ;
while ( 1 ) {
getline ( cin, str) ;
if ( str[ 0 ] == '.' && str. size ( ) == 1 )
break ;
i++ ;
int ret= str. find ( "chi1 huo3 guo1" ) ;
if ( ret!= - 1 ) {
if ( j== 0 )
j= i;
k++ ;
}
}
cout<< i<< endl;
if ( k== 0 )
cout<< "-_-#" << endl;
else
cout<< j<< " " << k<< endl;
return 0 ;
}
71、前世档案
# include <iostream>
# include <string>
using namespace std;
int main ( )
{
int n, m;
string str;
cin>> n>> m;
while ( m-- ) {
cin>> str;
int num= 0 ;
int ret= 1 ;
for ( int i= str. size ( ) - 1 ; i>= 0 ; i-- )
{
if ( str[ i] == 'n' )
num= num+ 1 * ret;
ret*= 2 ;
}
cout<< num+ 1 << endl;
}
return 0 ;
}
72、刮刮彩票
# include <iostream>
using namespace std;
int a[ 4 ] [ 4 ] ;
int book[ 10 ] = { 0 } ;
int b[ 20 ] = { 10000 , 36 , 720 , 360 , 80 , 252 , 108 , 72 , 54 , 180 , 72 , 180 , 119 , 36 , 306 , 1080 , 144 , 1800 , 3600 } ;
int main ( )
{
int i, j, x, y, ret;
for ( i= 1 ; i<= 3 ; i++ )
for ( j= 1 ; j<= 3 ; j++ ) {
cin>> a[ i] [ j] ;
book[ a[ i] [ j] ] ++ ;
if ( a[ i] [ j] == 0 )
{ x= i, y= j; }
}
for ( i= 1 ; i<= 9 ; i++ )
if ( book[ i] == 0 )
a[ x] [ y] = i;
for ( i= 1 ; i<= 3 ; i++ ) {
cin>> x>> y;
cout<< a[ x] [ y] << endl;
}
cin>> ret;
int num= 0 ;
if ( ret>= 1 && ret<= 3 )
for ( i= 1 ; i<= 3 ; i++ )
num+= a[ ret] [ i] ;
else if ( ret>= 4 && ret<= 6 )
for ( i= 1 ; i<= 3 ; i++ )
num+= a[ i] [ ret- 3 ] ;
else if ( ret== 7 )
num= a[ 1 ] [ 1 ] + a[ 2 ] [ 2 ] + a[ 3 ] [ 3 ] ;
else if ( ret== 8 )
num= a[ 1 ] [ 3 ] + a[ 2 ] [ 2 ] + a[ 3 ] [ 1 ] ;
cout<< b[ num- 6 ] << endl;
return 0 ;
}
73、人与神
# include <iostream>
using namespace std;
int main ( )
{
cout<< "To iterate is human, to recurse divine." << endl;
return 0 ;
}
74、两小时学完C语言
# include <iostream>
using namespace std;
int main ( )
{
int a, b, c;
cin>> a>> b>> c;
cout<< a- b* c<< endl;
return 0 ;
}
75、强迫症
# include <iostream>
using namespace std;
int main ( )
{
string str;
cin>> str;
if ( str. size ( ) == 4 ) {
if ( str[ 0 ] > '2' || ( str[ 0 ] == '2' && str[ 1 ] >= '2' ) )
cout<< "19" << str[ 0 ] << str[ 1 ] << "-" << str[ 2 ] << str[ 3 ] ;
else
cout<< "20" << str[ 0 ] << str[ 1 ] << "-" << str[ 2 ] << str[ 3 ] ;
}
else if ( str. size ( ) == 6 ) {
cout<< str[ 0 ] << str[ 1 ] << str[ 2 ] << str[ 3 ] << "-" << str[ 4 ] << str[ 5 ] ;
}
return 0 ;
}
76、降价提醒机器人
# include <iostream>
using namespace std;
int main ( )
{
int n, ret;
cin>> n>> ret;
while ( n-- ) {
float t;
cin>> t;
if ( t< ret)
printf ( "On Sale! %.1f\n" , t) ;
}
return 0 ;
}
77、大笨钟的心情
# include <iostream>
using namespace std;
int main ( )
{
int arr[ 25 ] ;
for ( int i= 0 ; i< 24 ; i++ )
cin>> arr[ i] ;
while ( 1 ) {
int ret;
cin>> ret;
if ( ret< 0 || ret> 23 )
break ;
if ( arr[ ret] > 50 )
cout<< arr[ ret] << " " << "Yes" << endl;
if ( arr[ ret] <= 50 )
cout<< arr[ ret] << " " << "No" << endl;
}
return 0 ;
}
78、吉老师的回归
# include <iostream>
# include <string>
# include <algorithm>
using namespace std;
int main ( )
{
int n, m;
int j= 0 ;
cin>> n>> m;
string a[ 31 ] ;
getchar ( ) ;
for ( int i= 1 ; i<= n; i++ ) {
getline ( cin, a[ i] ) ;
if ( ( a[ i] . find ( "qiandao" ) != - 1 ) || ( a[ i] . find ( "easy" ) != - 1 ) )
continue ;
if ( j== m) {
cout<< a[ i] << endl;
return 0 ;
}
j++ ;
}
cout<< "Wo AK le" << endl;
return 0 ;
}
79、天梯赛的善良
# include <iostream>
using namespace std;
int a[ 1000010 ] ;
int main ( )
{
int n, ret, mmin, mmax;
cin>> n;
cin>> ret;
a[ ret] ++ ;
mmin= ret, mmax= ret;
for ( int i= 1 ; i<= n- 1 ; i++ )
{
cin>> ret;
a[ ret] ++ ;
if ( ret< mmin)
mmin= ret;
if ( ret> mmax)
mmax= ret;
}
printf ( "%d %d\n" , mmin, a[ mmin] ) ;
printf ( "%d %d\n" , mmax, a[ mmax] ) ;
return 0 ;
}
80、乘法口诀数列
# include <iostream>
# include <vector>
using namespace std;
int main ( )
{
vector< int > mv;
int a1, a2, n, ret;
int l= 0 , r= 1 ;
cin>> a1>> a2>> n;
mv. push_back ( a1) ;
mv. push_back ( a2) ;
if ( n== 1 ) {
cout<< a1<< endl;
return 0 ;
}
if ( n== 2 ) {
cout<< a1<< " " << a2<< endl;
return 0 ;
}
while ( 1 ) {
ret= mv[ l++ ] * mv[ r++ ] ;
if ( ret>= 10 ) {
int b, c;
b= ret/ 10 ;
mv. push_back ( b) ;
if ( mv. size ( ) == n)
break ;
c= ret% 10 ;
mv. push_back ( c) ;
if ( mv. size ( ) == n)
break ;
}
else {
mv. push_back ( ret) ;
if ( mv. size ( ) == n)
break ;
}
}
for ( int i= 0 ; i< n; i++ )
if ( i== 0 )
cout<< mv[ 0 ] ;
else
cout<< " " << mv[ i] ;
return 0 ;
}
81、今天我要赢
# include <iostream>
using namespace std;
int main ( )
{
cout<< "I'm gonna win! Today!" << endl;
printf ( "%d-%02d-%02d\n" , 2022 , 4 , 23 ) ;
return 0 ;
}
82、种钻石
# include <iostream>
using namespace std;
int main ( )
{
int a, b;
cin>> a>> b;
cout<< a/ b<< endl;
return 0 ;
}
83、谁能进图书馆
# include <iostream>
using namespace std;
int main ( )
{
int a, b, c, d;
cin>> a>> b>> c>> d;
if ( ( c>= a&& d>= a) || ( c< a&& d>= b) || ( c>= b&& d< a) )
printf ( "%d-Y %d-Y\n" , c, d) ;
if ( c>= a&& c< b&& d< a)
printf ( "%d-Y %d-N\n" , c, d) ;
if ( c< a&& d>= a&& d< b)
printf ( "%d-N %d-Y\n" , c, d) ;
if ( c< a&& d< a)
printf ( "%d-N %d-N\n" , c, d) ;
int mmin, mmax;
if ( c> d)
{ mmin= 2 , mmax= 1 ; }
else if ( c< d)
{ mmin= 1 ; mmax= 2 ; }
if ( ( c>= b&& d< a) || ( d>= b&& c< a) )
printf ( "qing %d zhao gu hao %d\n" , mmax, mmin) ;
if ( c>= a&& d>= a)
printf ( "huan ying ru guan\n" ) ;
if ( c< a&& d< a)
printf ( "zhang da zai lai ba\n" ) ;
if ( ( c>= a&& c< b&& d< a) || ( d>= a&& d< b&& c< a) )
printf ( "%d: huan ying ru guan\n" , mmax) ;
return 0 ;
}
84、拯救外星人
# include <iostream>
using namespace std;
int func ( int n) {
if ( n== 1 )
return 1 ;
return n* func ( n- 1 ) ;
}
int main ( )
{
int a, b, c;
cin>> a>> b;
cout<< func ( a+ b) ;
return 0 ;
}
85、试试手气
# include <iostream>
using namespace std;
int main ( )
{
int a[ 6 ] ;
for ( int i= 0 ; i< 6 ; i++ ) cin>> a[ i] ;
int n;
cin>> n;
for ( int i= 0 ; i< 6 ; i++ )
{
for ( int j= 6 , c= 0 ; ; j-- )
if ( j!= a[ i] && ++ c== n)
{
if ( i== 5 )
cout<< j<< endl;
else
cout<< j<< ' ' ;
break ;
}
}
return 0 ;
}
86、斯德哥尔摩火车上的题
# include <iostream>
# include <string>
using namespace std;
int main ( )
{
string s1, s2;
string a, b;
cin>> a>> b;
for ( int i = 1 ; i < a. size ( ) ; i++ ) {
if ( a[ i] % 2 == a[ i- 1 ] % 2 ) {
s1 += max ( a[ i] , a[ i- 1 ] ) ;
}
}
for ( int i = 1 ; i < b. size ( ) ; i++ ) {
if ( b[ i] % 2 == b[ i- 1 ] % 2 ) {
s2 += max ( b[ i] , b[ i- 1 ] ) ;
}
}
if ( s1== s2)
cout<< s1<< endl;
else
cout<< s1<< endl<< s2<< endl;
return 0 ;
}
87、机工士姆斯塔迪奥
# include <iostream>
# include <set>
# include <algorithm>
using namespace std;
int main ( )
{
int n, m, q;
set< int > hh, ll;
cin>> n>> m>> q;
while ( q-- ) {
int t, c;
cin>> t>> c;
if ( t== 0 ) {
hh. insert ( c) ;
}
else if ( t== 1 ) {
ll. insert ( c) ;
}
}
cout<< n* m- hh. size ( ) * m- ll. size ( ) * n+ hh. size ( ) * ll. size ( ) << endl;
return 0 ;
}
88、静静的推荐
# include <iostream>
# include <algorithm>
using namespace std;
int cnt[ 300 ] ;
int main ( )
{
int n, k, s;
cin>> n>> k>> s;
int res= 0 ;
while ( n-- )
{
int a, b;
cin>> a>> b;
if ( a>= 175 )
{
if ( b>= s) res++ ;
else cnt[ a] ++ ;
}
}
for ( int i= 175 ; i<= 290 ; i++ )
res+= min ( cnt[ i] , k) ;
printf ( "%d\n" , res) ;
return 0 ;
}