- 问答
[NOIP2012 普及组] 寻宝
- 2024-10-5 16:58:18 @
我不会
1 条评论
-
Alexandar @ 2024-10-5 17:04:04
#include<bits/stdc++.h> using namespace std; typedef long long lop; struct node{ bool floor=0; int k; }s[10005][1005]; int f[10005]; int main(){ int n,m; cin>>n>>m; for(int i=1;i<=n;i++){ for(int j=0;j<m;j++){ cin>>s[i][j].floor; if(s[i][j].floor==1){ f[i]++; } cin>>s[i][j].k; } } lop house,ans=0; cin>>house; for(int i=1;i<=n;i++){ int y=s[i][house].k;//k ans+=s[i][house].k; ans%=20123; if(s[i][house].floor==1){ y--; } y=y%f[i]; if(y==0){ if(s[i][house].floor==1){ continue; }else{ while(1){ house--; if(house<0){ house=m-1; } if(s[i][house].floor==1){ break; } } continue; } }else{ while(y){ house++; if(house==m){ house=0; } if(s[i][house].floor==1){ y--; } } } } // cout<<ans; return 0; }
- 1