Advertisement
Guest User

Untitled

a guest
Sep 19th, 2017
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <time.h>
  3.  
  4. #pragma warning(disable:4996)
  5. int main() {
  6.  
  7. /*Timer 변수 선언*/
  8. clock_t before;
  9. double result;
  10. before = clock();
  11.  
  12. int n,sum=0;
  13. char arr[101];
  14.  
  15. scanf("%d", &n);
  16. scanf("%s", arr);
  17.  
  18. for (int i = 0; i < n; i++) {
  19. sum += arr[i] - 48;
  20. }
  21. printf("%d", sum);
  22.  
  23. /*Timer 출력*/
  24. result = (double)(clock() - before) / CLOCKS_PER_SEC;
  25. printf("\n걸린시간은 %f입니다.\n",result);
  26. return 0;
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement