zoukankan      html  css  js  c++  java
  • [模拟] 多校赛-开学觉醒赛 G 骰子

    题目描述

    silechen有一颗骰子,他喜欢跟骰子玩游戏,一开始他将骰子平放在地上,然后骰子按照silechen的指令在地上滚动,silechen想将知道骰子每次接触地面的面(也就是骰子的下面)的值加起来是多少(注意,一开始接触地面的值也要算进去)? 

    输入

    第一行是数据组数 1<=T<=10 

        接下来每组数据 

        第一行是6个整数,表示骰子的前、后、左、右、上、下的值是多少 

        第二行1<=n<=100000 

        第三行是n个整数,表示silenchen每次发出的指令 

        指令有4种 

        0:表示骰子向前滚动一次 

        1:表示骰子向后滚动一次 

        2:表示骰子向左滚动一次 

        3:表示骰子向右滚动一次 

    输出

    输出T行,每行一个整数ans,表示每次骰子接触地面的面加起来的值(保证ans在int范围内.

    1
    1 2 3 4 5 6
    4
    0 1 2 3
    22

    很有意思的模拟题目

    //#pragma GCC optimize(2)
    #include <cstdio>
    #include <iostream>
    #include <cstdlib>
    #include <cmath>
    #include <cctype>
    #include <string>
    #include <cstring>
    #include <algorithm>
    #include <stack>
    #include <queue>
    #include <set>
    #include <map>
    #include <ctime>
    #include <vector>
    #include <fstream>
    #include <list>
    #include <iomanip>
    #include <numeric>
    using namespace std;
    typedef long long ll;
    
    const int MAXN = 1e6 + 10;
    
    //1 2 3 4 5 6 
    //前后左右上下
    
    int arr[10] = {0}, ans = 0;
    
    int brr[10] = {0};
    
    void cal(int mode)
    {
    	ans += arr[6];
    
    	if(mode == 0)
    	{
    		brr[1] = arr[5];
    		brr[2] = arr[6];
    		brr[3] = arr[3];
    		brr[4] = arr[4];
    		brr[5] = arr[2];
    		brr[6] = arr[1];
    	}
    	if(mode == 1)
    	{
    		brr[1] = arr[6];
    		brr[2] = arr[5];
    		brr[3] = arr[3];
    		brr[4] = arr[4];
    		brr[5] = arr[1];
    		brr[6] = arr[2];
    	}
    	if(mode == 2)
    	{
    		brr[1] = arr[1];
    		brr[2] = arr[2];
    		brr[3] = arr[5];
    		brr[4] = arr[6];
    		brr[5] = arr[4];
    		brr[6] = arr[3];
    	}
    	if(mode == 3)
    	{
    		brr[1] = arr[1];
    		brr[2] = arr[2];
    		brr[3] = arr[6];
    		brr[4] = arr[5];
    		brr[5] = arr[3];
    		brr[6] = arr[4];
    	}
    	for(int i = 1; i<= 6; i++)
    	{
    		arr[i] = brr[i];
    	}
    	return ;
    }
    
    int main()
    {
    	ios::sync_with_stdio(false);
    
    	cin.tie(0);     cout.tie(0);
    
        int T;
    
        cin>>T;
    
        while(T--)
        {
        	ans = 0;
        	
        	for(int i = 1; i <= 6; i++)
        		cin>>arr[i];
    
        	int oprt;
    
        	cin>>oprt;
    
        	while(oprt--)
        	{
        		int t;
    
        		cin>>t;
    
        		cal(t);
        	}
    
        	cout<<ans + arr[6]<<endl;
        }
    
        return 0;
    }
    
  • 相关阅读:
    [转]asp.net页面缓存技术
    UL和LI在div中的高度的IE6下兼容性
    jquery制作的横向图片滚动带横向滚动条TackerScroll
    电脑可以上网,但是qq登陆不上去?
    Introduction to discrete event system学习笔记4.6
    Introduction to Discrete event system学习笔记4.9
    Introduction to discrete event systemsstudy 4.5
    Symbolic synthesis of obserability requirements for diagnosability B.Bittner,M.Bozzano,A.Cimatti,and X.Olive笔记4.16
    Introduction to discrete event system学习笔记4.8pm
    Introduction to discrete event system学习笔记 4.8
  • 原文地址:https://www.cnblogs.com/zeolim/p/12270469.html
Copyright © 2011-2022 走看看