8 条题解

  • 0
    @ 2023-5-26 20:46:56
    #include <queue>
    #include <math.h>
    #include <stack>
    #include <stdio.h>
    #include <iostream>
    #include <vector>
    #include <iomanip>
    #include <string.h>
    #include <algorithm>
    #include <cstring>
    #include <bits/stdc++.h>
    using namespace std;
    int a; 
    bool zhi(int x){
    	for(int i=2;i*i<=x;i++){
    		if(!(x%i))return false;
    	}
    	return true;
    }
    void shu(int x){
    	for(int i=3;i<=x/2;i++)	{
    		if(zhi(i)==1){
    			if(zhi(x-i)==1){
    				cout<<i<<"+"<<x-i<<"="<<x<<"\n";
    				a++; 
    			}
    		}
    	}
    }
    int main(){
    	int m,n;
    	cin>>m>>n;
    	for(int i=m;i<=n;i+=2){
    		shu(i); 
    	}
    	cout<<a;
    	return 0;
    }
    

    信息

    ID
    908
    时间
    1000ms
    内存
    128MiB
    难度
    5
    标签
    递交数
    544
    已通过
    217
    上传者