zoukankan      html  css  js  c++  java
  • Codeforces 1137D(技巧)

    一开始写的第一步让0和1一起走然后第二步再让0走会挂最后一个点……然后探索一下觉得主要问题在于我模拟的一步一步地走。如果这样的话9 2这个数据会使第17步他俩就碰在final点了,而实际上我们想要的效果是他们走第18步时差一格,然后第20步碰上后大家一起,所以提前碰到会炸。故而要两步两步地走才行,发现01碰到了就跳出然后大家一起走。

    int main() {
    	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    
    	auto Read = [](int &x) {
    		cin >> x;
    		for (int i = 0; i < x; i++) {
    			string s; cin >> s;
    		}
    	};
    	int cur = -1;
    	while (cur != 2) {
    		cout << "next 0
    " << flush;
    		Read(cur);
    		cout << "next 0 1
    " << flush;
    		Read(cur);
    	}
    	while (cur != 1) {
    		cout << "next";
    		for (int i = 0 ;i <= 9; i++)
    			cout << " " << i;
    		cout << endl << flush;
    		Read(cur);
    	}
    	cout << "done
    ";
    	return 0;
    }
    
  • 相关阅读:
    Beta 冲刺day 6
    Beta冲刺day5
    Beta冲刺day4
    Beta 冲刺day3
    Beta 冲刺day2
    Beta冲刺day1
    Beta预备
    城市安全风险管理项目Postmortem结果
    项目总结
    Alpha冲刺置顶随笔
  • 原文地址:https://www.cnblogs.com/AlphaWA/p/10700562.html
Copyright © 2011-2022 走看看