Submission #2672233


Source Code Expand

#include<bits/stdc++.h>
using namespace std;
long long n;
string s;
int main()
{
	scanf("%s",&s);
	for (i=0;i<6;i++)
	  if (s[i]==49) n++;
	printf("%d\n",n);
	return 0;
}

Submission Info

Submission Time
Task A - Accepted...?
User luogu_bot1
Language C++ (GCC 5.4.1)
Score 0
Code Size 181 Byte
Status CE

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:7:15: warning: format ‘%s’ expects argument of type ‘char*’, but argument 2 has type ‘std::string* {aka std::basic_string<char>*}’ [-Wformat=]
  scanf("%s",&s);
               ^
./Main.cpp:8:7: error: ‘i’ was not declared in this scope
  for (i=0;i<6;i++)
       ^
./Main.cpp:10:17: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘long long int’ [-Wformat=]
  printf("%d\n",n);
                 ^
./Main.cpp:7:16: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
  scanf("%s",&s);
                ^