观察一下序列,每3个数一组,第一个数余1,不能,加第二个数后整除(第二个数本身余2),第三数恰整除。一行代码的事。011011011....

#include<iostream>
using namespace std;
int main()
{
    int n;
    while(cin>>n)
    {
        cout<<n/3*2+(n%3==2?1:0)<<endl;   
    }
    return 0;
}


相关文章:

  • 2022-02-09
  • 2021-05-31
  • 2022-01-04
  • 2022-12-23
  • 2021-08-01
  • 2022-03-03
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-06-11
  • 2022-12-23
  • 2021-10-23
相关资源
相似解决方案