回答編集履歴
6
一行版のインクリメントを前置に修正
answer
CHANGED
@@ -15,6 +15,6 @@
|
|
15
15
|
#include <stdint.h>
|
16
16
|
|
17
17
|
int main( void ){
|
18
|
-
for( int8_t i = 1; i < 9;
|
18
|
+
for( int8_t i = 1; i < 9; ++i )i>=4 ? i==4 ? printf("%d \n\n" , i ) : printf("%d \n" , (i-9)*-1 ) : printf("%d \n" , i );
|
19
19
|
}
|
20
20
|
```
|
5
追記文言修正
answer
CHANGED
@@ -9,7 +9,7 @@
|
|
9
9
|
}
|
10
10
|
```
|
11
11
|
|
12
|
-
追記
|
12
|
+
追記: 一行版
|
13
13
|
```c
|
14
14
|
#include <stdio.h>
|
15
15
|
#include <stdint.h>
|
4
文章修正
answer
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
マジックナンバー
|
1
|
+
マジックナンバーと三項演算子使っていいならこれでもいけます。
|
2
2
|
```c
|
3
3
|
#include <stdio.h>
|
4
4
|
#include <stdint.h>
|
3
1行版追記
answer
CHANGED
@@ -7,4 +7,14 @@
|
|
7
7
|
for( int8_t i = 1; i < 5; ++i )i==4 ? printf("%d \n\n" , i ) : printf("%d \n" , i );
|
8
8
|
for( int8_t i = -1; i > -5; --i )printf("%d \n" , 5+i );
|
9
9
|
}
|
10
|
+
```
|
11
|
+
|
12
|
+
追記
|
13
|
+
```c
|
14
|
+
#include <stdio.h>
|
15
|
+
#include <stdint.h>
|
16
|
+
|
17
|
+
int main( void ){
|
18
|
+
for( int8_t i = 1; i < 9; i++ )i>=4 ? i==4 ? printf("%d \n\n" , i ) : printf("%d \n" , (i-9)*-1 ) : printf("%d \n" , i );
|
19
|
+
}
|
10
20
|
```
|
2
インクリメントとデクリメント部分を前置に修正
answer
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
#include <stdint.h>
|
5
5
|
|
6
6
|
int main( void ){
|
7
|
-
for( int8_t i = 1; i < 5;
|
7
|
+
for( int8_t i = 1; i < 5; ++i )i==4 ? printf("%d \n\n" , i ) : printf("%d \n" , i );
|
8
|
-
for( int8_t i = -1; i > -5;
|
8
|
+
for( int8_t i = -1; i > -5; --i )printf("%d \n" , 5+i );
|
9
9
|
}
|
10
10
|
```
|
1
備考追加
answer
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
マジックナンバーが入っててもいいならこれでも行けます。
|
1
2
|
```c
|
2
3
|
#include <stdio.h>
|
3
4
|
#include <stdint.h>
|