一道很简单但我不会做的题
  • 板块灌水区
  • 楼主loseinlosing
  • 当前回复1
  • 已保存回复1
  • 发布时间2023/11/26 15:55
  • 上次更新2023/11/26 17:42:28
查看原帖
一道很简单但我不会做的题
1097871
loseinlosing楼主2023/11/26 15:55

就是一道模拟:Control表,不知道为什么我老是报错

#include<bits/stdc++.h>
using namespace std;
int main(){
    int n, i = 1, j = 2, bs, fx = 1;
	cin >> n;
	while(n >= 0){
		n--;
		if(fx == 1 && j == 1 && i % 2 == 1){
			fx = 0;
			i++;
			continue;
		}
		if(fx == 0 && i == 1 && j % 2 == 0){
			fx = 1;
			j++;
			continue;
		}
		if(fx == 0)
			j++, i--;
		if(fx == 1)
			j--, i++;	
	}		
	cout << j << "/" << i;
	return 0;
}
2023/11/26 15:55
加载中...