diff options
author | Nguyễn Gia Phong <vn.mcsinyx@gmail.com> | 2020-01-14 18:29:11 +0700 |
---|---|---|
committer | Nguyễn Gia Phong <vn.mcsinyx@gmail.com> | 2020-01-14 18:29:11 +0700 |
commit | a3dd2581ed4847670f81157091016c14ca18803d (patch) | |
tree | 3362ab15de119f1e75799f58715b7683e6bfd6ca /usth/MATH2.3/5/automata-to-grammar.c | |
parent | 65b8ebda4c47fa27ac28899fb2b29097f445b6df (diff) | |
download | cp-a3dd2581ed4847670f81157091016c14ca18803d.tar.gz |
[usth/MATH2.3] Mathemate Discretely
Diffstat (limited to 'usth/MATH2.3/5/automata-to-grammar.c')
-rw-r--r-- | usth/MATH2.3/5/automata-to-grammar.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/usth/MATH2.3/5/automata-to-grammar.c b/usth/MATH2.3/5/automata-to-grammar.c new file mode 100644 index 0000000..430782a --- /dev/null +++ b/usth/MATH2.3/5/automata-to-grammar.c @@ -0,0 +1,16 @@ +#include <stdio.h> + +int main() +{ + int n, b, j, k; + + scanf("%d", &n); + for (int i = 0; i < n; ++i) { + scanf("%d %d %d", &b, &j, &k); + if (b) + printf("%c -> $\n", 'S' + i); + printf("%c -> 0%c\n%c -> 1%c\n", i+83, j+83, i+83, k+83); + } + + return 0; +} |