diff options
author | Raphael McSinyx <vn.mcsinyx@gmail.com> | 2017-01-02 20:37:59 +0700 |
---|---|---|
committer | Raphael McSinyx <vn.mcsinyx@gmail.com> | 2017-01-02 20:37:59 +0700 |
commit | 57d767cf4e4d5b83645bda2c4e398fdd76d059e1 (patch) | |
tree | 557cc70d5dc663b5ee3bef2be4d749ddc3cfbc4c /others/easy20160714/21.c | |
parent | 7206ecee7579a10dd347d06b397b3790e969f8f3 (diff) | |
download | cp-57d767cf4e4d5b83645bda2c4e398fdd76d059e1.tar.gz |
Update others/easy20160714
Diffstat (limited to 'others/easy20160714/21.c')
-rw-r--r-- | others/easy20160714/21.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/others/easy20160714/21.c b/others/easy20160714/21.c new file mode 100644 index 0000000..53951a1 --- /dev/null +++ b/others/easy20160714/21.c @@ -0,0 +1,23 @@ +#include <stdio.h> + +int main() +{ + FILE * f = fopen("INP.TXT", "r"); + int n, i, preva, a, r = 1; + + fscanf(f, "%d", &n, &preva); + for (i = 1; i < n; i++) { + fscanf(f, "%d", &a); + if (a > preva) + r++; + preva = a; + } + + fclose(f); + + f = fopen("OUT.TXT", "w"); + fprintf(f, "%d\n", r); + fclose(f); + + return 0; +} |