Fortune-telling with camomile

Fortune-telling with camomile
Time limit per test: 0.5 second(s)
Memory limit: 65536 kilobytes
input: standard
output: standard



Masha loves Petya. The following question gives her no rest: does Petya love her too? The best way to find this out is a fortune-telling. There are plenty ways of fortune predicting, but Masha prefers fortune-telling with camomile more than others. It's rules are simple. You should take camomile into the right hand and start picking petals one by one. After each petal you should pronounce one phrase from the predefined list. Such phrases like "loves", "doesn't love", "loves sincerely", "doubts", "wants to date", "laughs" are usually used. Phrases are pronounced from the first to the last. The list of phrases is cyclic, so after the last phrase you should pronounce the first one. The phrase that you pronounce after the last petal will be an answer.

Since Masha doesn't want to go to the forest and look for camomiles, she asks you to write the program which will simulate the process.

Input
First line of the input file contains two integer numbers N and M (1 ≤ N ≤ 100, 1 ≤ M ≤ 100), the number of petals and the number of phrases. Each of the following M lines contains one phrase. Phrases consist only of latin letters and their lengths are between 1 and 100.

Output
Output the resulting phrase.

Example(s)
sample input
sample output
6 4
loves
doesnt
sincerely
doubts
doesnt

sample input
sample output
9 3
loves
doesnt
hates
hates


#include<cstdio>
#include<cstring>
using namespace std;
int main()
{
    int n,m;
    char t[105],res[105];
    while(scanf("%d%d",&n,&m)!=EOF)
    {
        int k=n%m;
        if(k==0)
         k=m;
       // printf("%d\n",k);
        for(int i=1;i<=m;i++)
        {
            if(i==k)
             scanf("%s",res);
            else
             scanf("%s",t);
        }
       printf("%s\n",res);
    }
    return 0;
}


### @fortune-sheet/react 与 Vue 集成 为了实现 `@fortune-sheet/react` 组件在 Vue 应用中的集成,可以采用以下策略: #### 使用 Web Components 或者封装 React Component 由于直接在 Vue 中使用 React 组件并非直截了当的任务,一种常见的做法是通过 Web Components 技术来桥接这两种框架之间的差异。另一种方式则是利用像 `react-vue-hybrid` 这样的工具包来进行转换。 然而更推荐的方法是在 Vue 项目里创建一个自定义组件作为容器,在其中加载并渲染来自 `@fortune-sheet/react` 的 Excel 表格功能。这通常涉及到以下几个方面的工作: - 安装必要的依赖项; - 创建用于包裹 React 组件的 Vue Wrapper 组件; - 处理生命周期事件以确保正确初始化和销毁嵌入式的 React 实例; 下面是一个简单的例子展示如何在一个基于 Vue 构建的应用程序中引入 Fortune Sheet 并使其正常运作: ```javascript // main.js - 主应用入口文件 import { createApp } from 'vue'; import App from './App.vue'; createApp(App).use(/* 插件 */).mount('#app'); ``` ```html <!-- MySpreadsheetComponent.vue --> <template> <div id="spreadsheet-container"></div> </template> <script setup lang="ts"> import { onMounted, defineComponent } from "vue"; import ReactDOM from "react-dom/client"; const SpreadsheetWrapper = defineComponent({ name: "SpreadsheetWrapper", mounted() { const container = document.getElementById('spreadsheet-container')!; // 假设已经安装好了 react 和 @fortune-sheet/react import('@fortune-sheet/react').then(({default: ReactSpreadsheet}) => { const root = ReactDOM.createRoot(container); root.render(<ReactSpreadsheet />); }); } }); export default SpreadsheetWrapper; </script> ``` 此代码片段展示了如何动态导入 `@fortune-sheet/react` 并将其挂载到指定 DOM 节点上。需要注意的是实际开发过程中可能还需要处理更多细节问题,比如样式冲突、数据传递等[^1]。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值