Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdlib.h>
- #include <fcntl.h>
- #include <stdio.h>
- #include <zconf.h>
- int main(int argc, char *argv[])
- {
- char *filename = argv[1];
- int mod = atoi(argv[2]);
- int fd = open(filename, O_WRONLY | O_TRUNC | O_CREAT, 0751);
- if (fd < 0) {
- return 1;
- }
- const char pattern[] =
- "#!/usr/bin/python3\n"
- "val = int(input())\n"
- "print(val*(val + 1)//2 %% %d)\n";
- dprintf(fd, pattern, mod);
- close(fd);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement