Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int max(int x, int y) {
- if (x >= y) {
- return x;
- }
- else {
- return y;
- }
- }
- int main(int argc, char** argv) {
- for (int i = 1; i < argc; ++i) {
- int j;
- int fst = 2;
- for (j = 2; argv[i][j] != '\0'; ++j) {
- if (fst == j && argv[i][j] == '0') {
- ++fst;
- }
- }
- int len = j - fst;
- printf("%d ", max((len + 1) / 2, 1));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement