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

1:修订间差异

来自八中答案网
Boss留言 | 贡献
无编辑摘要
Boss留言 | 贡献
无编辑摘要
第1行: 第1行:
cpp'
<pre><code class="language-cpp">int main()
#include <bits/stdc++.h>
using namespace std;
 
int jisuan(long long n)
{
{
for(long long i=2;i*i<=n;++i)
    cin.tie(0)-&gt;sync_with_stdio(0);
if(n%i==0) return false;
    cout.tie(0);
    return true;
    int n, k;
   
    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++;


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

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

<code class="language-cpp">int main()
{
    cin.tie(0)->sync_with_stdio(0);
    cout.tie(0);
    int n, k;
    cin >> n >> k;
    while (k--)
    {
        int x, y;
        cin >> x >> y;
        string op;
        cin >> op;
        for (int i = 0; i < 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 >= 1 and tx <= n and ty >= 1 and ty <= n)
            {
                x = tx, y = ty;
            }
        }
        cout << x << ' ' << y << '\n';
    }
}
</code>