답안 #485951

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
485951 2021-11-09T19:50:57 Z tato Lutrija (COCI19_lutrija) C++14
0 / 70
1 ms 204 KB
#include <bits/stdc++.h>
#define ll long long
using namespace std;

bool check(ll a)
{
	ll x=sqrt(a);
	
	for(ll k=2; k<=x; k++)
		if(a%k==0)
			return false;
			
			return true;
	
	
	
}

int main()
{
	ll  a,b;
	
	cin>>a>>b;
	
	if(a==2 or b==2)
		{
			if(check(a+b))
			{cout<<3<<'\n';
			cout<<a<<' '<<a+b<<' '<<b;
			
			return 0;
				
			}
			
		}
	
	if(abs(a-b)==2)
		{
			cout<<2<<'\n';
			cout<<a<<' '<<b;
			return 0;
		}
	if(a==b)
	{
		cout<<3<<'\n';
		cout<<a<<' '<<a+2<<' '<<b;
		return 0;
	}
	if(abs(a-b)>60 or abs(a-b)==1)
		{
			cout<<-1;
			return 0;
		}
	vector <ll> v;
	for(ll i=min(a,b); i<=b; i+=2)
		{
			if(check(i))
				{
					cout<<-1;
					return 0;
				}
			else
				v.push_back(i);
		}
	cout<<v.size()<<'\n';
	
	for(int k=1; k<v.size(); k++)
		cout<<v[k]<<' ';
	
	return 0;
}

Compilation message

lutrija.cpp: In function 'bool check(long long int)':
lutrija.cpp:10:3: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
   10 |   if(a%k==0)
      |   ^~
lutrija.cpp:13:4: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
   13 |    return true;
      |    ^~~~~~
lutrija.cpp: In function 'int main()':
lutrija.cpp:67:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   67 |  for(int k=1; k<v.size(); k++)
      |               ~^~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Incorrect 0 ms 204 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -