Skip to content

Commit 6327715

Browse files
committedNov 27, 2016
clean, update 1009
2 parents bd186e9 + baf395a commit 6327715

File tree

12 files changed

+139
-89
lines changed

12 files changed

+139
-89
lines changed
 

‎.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
*.out
2-
*.bin
1+
**/*.out
2+
**/*.bin

‎1

Lines changed: 0 additions & 60 deletions
This file was deleted.

‎1009.c

Lines changed: 52 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,60 @@
11
/*说反话*/
2-
2+
#include<string.h>
33
#include<stdio.h>
44
int main(){
55

66
char a[80] ;
7-
int i = 0 ;
8-
int max ;
7+
int k ;
8+
int i ;
9+
int j ;
10+
int t ;
11+
int n[80] = {0} ;
912

13+
gets(a) ;
14+
15+
n[0] = strlen(a) ;
16+
j = 1 ;
17+
18+
for ( i = strlen(a) ; i > 0 ; i--) {
19+
if ( a[i] == ' '){
20+
n[j++] = i ;
21+
}
22+
}
23+
24+
t = j ;
25+
26+
for ( j = 0 ; n[t] == 0 ; j++) {
27+
if ( a[j] == ' ')
28+
n[t] = j ;
29+
}
30+
// printf("%d",n[t]) ;
31+
j = 0 ;
32+
for ( i = strlen(a) ; i >= 0 ; i--){
33+
if ( a[i] == ' ' && n[j] > 0){
34+
if ( j == 0) {
35+
36+
for ( k = i + 1 ; k <= n[j] ; k++ ){
37+
printf( "%c",a[k]) ;
38+
}
39+
j ++ ;
40+
printf(" ") ;
1041

11-
for ( i = 0 ; i < max ; i++)
12-
printf("%c",a[i]);
13-
printf("%d",max) ;
14-
return 0 ;
42+
}
43+
else if ( j > 0 && n[j+1] > 0 ){
44+
45+
for ( k = i + 1; k <= n[j] ; k++){
46+
printf("%c",a[k]) ;
47+
}
48+
j++ ;
49+
}
50+
else if ( j == n[t]){
51+
52+
for ( k = 0 ; k <= n[t] ; k++) {
53+
printf("%c",a[k]) ;
54+
}
55+
j++ ;
56+
}
57+
}
58+
}
59+
return 0 ;
1560
}

‎1011.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,21 @@
33

44
int main(){
55

6-
long a[10] ;
7-
long b[10] ;
8-
long c[10] ;
6+
long long a[10] ;
7+
long long b[10] ;
8+
long long c[10] ;
99
int t ;
1010
int i ;
1111

1212
scanf("%d",&t);
1313

1414
for ( i = 0 ; i < t ; i++)
15-
scanf("%ld %ld %ld",&a[i],&b[i],&c[i]) ;
15+
scanf("%lld %lld %lld",&a[i],&b[i],&c[i]) ;
1616

1717
for ( i = 0 ; i < t ; i++){
1818

1919
if ( a[i] + b[i] > c[i])
20-
printf("Case #%d: ture\n",i+1);
20+
printf("Case #%d: true\n",i+1);
2121
else
2222
printf("Case #%d: false\n",i+1);
2323
}

‎1027.in

-8.57 KB
Binary file not shown.

‎1029.c

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
/*旧键盘*/
2+
3+
#include<stdio.h>
4+
#include<ctype.h>
5+
6+
7+
int main () {
8+
9+
char input1[80] ;
10+
char input2[80] ;
11+
int b[127] = {0} ;
12+
int j ;
13+
int i ;
14+
15+
scanf("%s",input1) ;
16+
scanf("%s",input2) ;
17+
18+
j = 0 ;
19+
for ( i = 0 ; input1[i] != '\0' ; i++ ) {
20+
if ( input1[i] == input2[j])
21+
j++ ;
22+
23+
else{
24+
if ( (int)input1[i] >=65 && (int)input1[i] <=90 ){
25+
if ( b[(int)input1[i]] == 0 && b[(int)input1[i] + 32] == 0){
26+
b[(int)input1[i]] = 1 ;
27+
b[(int)input1[i] +32] = 1 ;
28+
printf("%c",toupper(input1[i])) ;
29+
}
30+
}
31+
else if ( (int)input1[i] >=97 && (int)input1[i] <=122) {
32+
if ( b[(int)input1[i]] == 0 && b[(int)input1[i] -32] == 0 ) {
33+
34+
b[(int)input1[i]] = 1 ;
35+
b[(int)input1[i] - 32 ] = 1 ;
36+
printf("%c",toupper(input1[i]));
37+
}
38+
}
39+
else {
40+
41+
if ( b[(int)input1[i]] == 0) {
42+
b[(int)input1[i]] = 1 ;
43+
printf("%c",input1[i]) ;
44+
}
45+
}
46+
}
47+
}
48+
return 0 ;
49+
}

‎1030

-8.6 KB
Binary file not shown.

‎neo1009.c

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#include <stdio.h>
2+
#include <string.h>
3+
4+
int main(void) {
5+
char str[80];
6+
int i = 0, j = 0, k = 0;
7+
int wordlen = 0;
8+
9+
gets(str);
10+
11+
i = strlen(str)-1;
12+
while(i>=0) {
13+
i = i-wordlen;
14+
wordlen = 0; // 重置
15+
for(j=i; j>=0; j--) {
16+
if(str[j] == ' ') {
17+
for(k=j+1; k<=i; k++) { printf("%c", str[k]); }
18+
printf(" ");
19+
wordlen+=1; // 跳过空格
20+
break;
21+
}
22+
else { wordlen++; }
23+
}
24+
}
25+
// 输出第一个单词
26+
for(i=0; str[i]!=' '; i++) {
27+
printf("%c", str[i]);
28+
}
29+
30+
return 0;
31+
}

‎neo1029.c

Whitespace-only changes.

‎test.bin

-8.45 KB
Binary file not shown.

‎test.c

Lines changed: 0 additions & 14 deletions
This file was deleted.

‎test.txt

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)
Please sign in to comment.