acdream1408:http://115.28.76.232/problem?pid=1408

题意:给你一个x,让你构造a,b,是的na+bm可以组成大于x的所有的数。a>1,b>1,但是不能组成x.

题解:这一题一开始sb。可以想到的是,所有的数(>=2)都可以由一个2和一个奇数组成。所以2和x+2,就是一个解。并且如果x是偶数,这是无解的。

 #include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstring>
#include<vector>
using namespace std;
int main(){
long long a;
while(~scanf("%lld",&a)){
if(a%==)printf("0 0\n");
else{
printf("%d %lld\n",,a+);
} } }

随机推荐

  1. html同一个页面多个倒计时

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html> <head ...

  2. Exchanger, Changing data between concurrent tasks

    The Java concurrency API provides a synchronization utility that allows the interchange of data betw ...

  3. 过滤textarea

    Function UBBFilter(ByVal reString) Dim Str:Str=reString If Not IsNull(Str) Then Str = Replace(Str, & ...

  4. HTTP和HTTPS详解

    http://blog.csdn.net/mingli198611/article/details/8055261/ 转自:http://www.cnblogs.com/ok-lanyan/archi ...

  5. 自定义popupmenu菜单背景色

    procedure TForm1.N11DrawItem(Sender: TObject; ACanvas: TCanvas; ARect: TRect; Selected: Boolean); be ...

  6. jQuery 源码分析 8: 回头看jQuery的构造器(jQuery.fn,jQury.prototype,jQuery.fn.init.prototype的分析)

    在第一篇jQuery源码分析中,简单分析了jQuery对象的构造过程,里面提到了jQuery.fn.jQuery.prototype.jQuery.fn.init.prototype的关系. 从代码中 ...

  7. leetcode problem 42 -- Trapping Rain Water

    Given n non-negative integers representing an elevation map where the width of each bar is 1, comput ...

  8. 还原数据库备份文件时,关于“System.Data.SqlClient.SqlError:媒体集有2个媒体簇,但只提供了1个。必须提供所有成员”的处理方式

    好久没写博客了,最近在做毕设的权限管理模块,今天在还原数据库文件时,遇到了“System.Data.SqlClient.SqlError:媒体集有2个媒体簇,但只提供了1个.必须提供所有成员”这个错误 ...

  9. css写圆角效果

    .introTips i{ position: absolute; display: block; top: 8px; right: 8px; width:; height:; font-size:; ...

  10. ACE_linux:读写锁

    1.涉及类 ACE_RW_Thread_Mutex //ACE读写锁ACE_Read_Guard //ACE加读锁ACE_Write_Guard //ACE加写锁ACE_Thread_Manager ...