打开/关闭菜单
打开/关闭外观设置菜单
打开/关闭个人菜单
未登录
未登录用户的IP地址会在进行任意编辑后公开展示。

1:修订间差异

来自八中答案网
Boss留言 | 贡献
无编辑摘要
Boss留言 | 贡献
无编辑摘要
第1行: 第1行:
<pre><code class="language-cpp">int main()
<pre><code class="language-cpp">#include <bits/stdc++.h>
using namespace std;
 
int jisuan(long long n)
{
{
    cin.tie(0)-&gt;sync_with_stdio(0);
for(long long i=2;i*i<=n;++i)
    cout.tie(0);
if(n%i==0) return false;
    int n, k;
    return true;
    cin &gt;&gt; n &gt;&gt; k;
   
    while (k--)
}
    {
        int x, y;
        cin &gt;&gt; x &gt;&gt; y;
        string op;
        cin &gt;&gt; op;
        for (int i = 0; i &lt; op.size(); i++)
        {
            int tx = x, ty = y;
            if (op[i] == 'f')
                ty++;
            else if (op[i] == 'b')
                ty--;
            else if (op[i] == 'l')
                tx--;
            else
                tx++;


            if (tx &gt;= 1 and tx &lt;= n and ty &gt;= 1 and ty &lt;= n)
 
            {
int main()
                x = tx, y = ty;
{
            }
long long n,sum=0;
        }
cin>>n;
        cout &lt;&lt; x &lt;&lt; ' ' &lt;&lt; y &lt;&lt; '\n';
    for(long long i=2;i<=n;++i)
    }
        if(jisuan(i)) ++sum;
cout<<sum;
return 0;
}
}
</code></pre>
</code></pre>

2025年1月19日 (日) 11:05的版本

<code class="language-cpp">#include <bits/stdc++.h>
using namespace std;

int jisuan(long long n)
{
	for(long long i=2;i*i<=n;++i)
		if(n%i==0) return false;
    return true;
    
}


int main()
{
	long long n,sum=0;
	cin>>n;
    for(long long i=2;i<=n;++i)
        if(jisuan(i)) ++sum;
	cout<<sum;
	return 0;
}
</code>