地区选择是项目开发中常用的操作,本文讲的控件是在手机端使用的选择控件,不仅可以用于实现地区选择,只要是3个级别的选择都可以实现,比如专业选择、行业选择、职位选择等。效果如下图所示:

附:本实例asp.net mvc中使用jquery H5省市县三级地区选择控件及中国省市县标准地区库下载地址

咨询QQ:806693619

一、实现原理

一般常用输入控件是input,当点击input的时候执行jquery获取焦点事情,然后弹出本地区选择插件,选择完地区后点击确定将选择的值返回给input完成地区输入。核心代码包括样式文件、h5自适应rem.js脚本、控件核心js脚本及后台数据提供代码。

二、核心js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
$(function () {
    $("#inputVal").focus(function () {
        $.selectPanel("1", "/PubConfig/GetAreaList", "山东省", "inputVal");
    });
    //默认允许选择个数
    var pubSelectNum = 2;
    //记录第一级选择值
    var pubFirstVal;
    //记录第二级选择值
    var secondVal;
    //默认数据获取地址
    var pubAjaxUrl = "/PubConfig/GetAreaList";
    //返回值赋予对象ID
    var pubReturnObjId;
    $.extend({
        //初始化数据
        selectPanel: function (selectNum, ajaxUrl,defaultVal,returnObjId) {
            pubSelectNum = selectNum;
            pubAjaxUrl = ajaxUrl;
            pubFirstVal = defaultVal;
            pubReturnObjId = returnObjId;
            initLayout();
            //第一级别
            $.ajax({
                url: pubAjaxUrl,
                type: 'POST',
                cache: false,
                dataType: 'json',
                data: { pId: "ROOT" },
                success: function (data) {  //成功事件
                    var listr = "", firstId = "";
                    $.each(data, function (i, item) {
                        //配置默认省份
                        if (data[i].NAME == defaultVal) {
                            firstId = data[i].ID;
                            listr = listr + "<li id='" + data[i].ID + "' data-title=\"" + data[i].NAME + "\" class=\"act font18\">" + data[i].NAME + "</li>";
                        }
                        else
                            listr = listr + "<li id='" + data[i].ID + "' data-title=\"" + data[i].NAME + "\" class=\"font18\">" + data[i].NAME + "</li>";
                    });
                    $(".p-first").empty();
                    $(".p-first").append(listr);
                    //初始化第二级别
                    $.ajax({
                        url: pubAjaxUrl,
                        type: 'POST',
                        cache: false,
                        dataType: 'json',
                        data: { pId: firstId },
                        success: function (data) {  //成功事件
                            var listr = "", firstId = "";
                            $.each(data, function (i, item) {
                                if (data[i].PID == "Yes")
                                    listr = listr + "<li id='" + data[i].ID + "' data-title=\"" + data[i].NAME + "\" class=\"foldIco font18\">" + data[i].NAME + "</li>";
                                else
                                    listr = listr + "<li id='" + data[i].ID + "' data-title=\"" + data[i].NAME + "\" class=\"font18\">" + data[i].NAME + "</li>";
                            });
                            $(".p-second").empty();
                            $(".p-second").append(listr);
                        },
                        error: function (XMLHttpRequest, textStatus, errorThrown) { //发送失败事件
                            alert(textStatus);
                        }
                    });
                },
                error: function (XMLHttpRequest, textStatus, errorThrown) { //发送失败事件
                    alert(textStatus);
                }
            });
        }
    });
    //向body加载初始布局
    function initLayout() {
        $(".selectPanel").remove();
        var StringArray = [];
        StringArray.push("<div class=\"sl-mask\" style=\"opacity: 1;\"></div>");
        StringArray.push("<div class= \"selectPanel sl-actionsheet-toggle\">");
        StringArray.push("<div class=\"p-bar\">");
        StringArray.push("<div class=\"sl-btn sl-btn-inline sl-btn-small sl-btn-border-gray cancelBtn font18\">取消</div>");
        StringArray.push("<div class=\"sl-btn sl-btn-inline sl-btn-small sl-btn-border-orange p-bar-right confirmBtn font18\">确定</div>");
        StringArray.push("</div>");
        StringArray.push("<div class=\"p-value font16\">");
        StringArray.push("</div>");
        StringArray.push("<div class=\"p-content\">");
        StringArray.push("<div class=\"p-content-panel\">");
        StringArray.push("<ul class=\"p-first\">");
        StringArray.push("</ul>");
        StringArray.push("</div>");
        StringArray.push("<div class=\"p-content-panel\">");
        StringArray.push("<ul class=\"p-second\">");
        StringArray.push("<ul class=\"p-three\">");
        StringArray.push("</ul>");
        StringArray.push("</ul>");
        StringArray.push("</div>");
        StringArray.push("</div>");
        StringArray.push("</div>");
        $("body").append(StringArray.join(""));
    }
    //取消
    $(".cancelBtn,.sl-mask").live("click", function () {
        $(".sl-mask").remove();
        $(".selectPanel").remove();
    });
    //确定
    $(".confirmBtn").live("click", function () {
        $("#" + pubReturnObjId).val("1");
        var selectedList = $(".p-value-cell");
        if (selectedList.length == 1)
        {
            $("#" + pubReturnObjId).val(selectedList.html());
        }
        else {
             
        }
        $(".selectPanel").remove();
        $(".sl-mask").remove();
    });
 
    //点击第一级别执行的
    $(".p-first>li").live("click", function () {
        var thisObject = $(this);
        pubFirstVal = thisObject.html();
        $(".p-first>li").removeClass("act");
        thisObject.addClass("act");
        //更新第二级别数据
        $.ajax({
            url: pubAjaxUrl,
            type: 'POST',
            cache: false,
            dataType: 'json',
            data: { pId: thisObject.attr("id") },
            success: function (data) {  //成功事件
                var listr = "", firstId = "";
                $.each(data, function (i, item) {
                    listr = listr + "<li id='" + data[i].ID + "' data-title=\"" + data[i].NAME + "\"  class=\"font18\">" + data[i].NAME + "</li>";
                });
                $(".p-second").empty();
                $(".p-second").append(listr);
            },
            error: function (XMLHttpRequest, textStatus, errorThrown) { //发送失败事件
                alert(textStatus);
            }
        });
    });
    //点击第二级别执行的
    $(".p-second>li").live("click", function () {
        var thisObject = $(this);
        secondVal = thisObject.html();
        if (thisObject.hasClass("act")) {
            thisObject.removeClass("act");
            $(".p-three").remove();
            thisObject.removeClass("expandIco");
            thisObject.addClass("foldIco");
        }
        else {
            $(".p-second>li").removeClass("act");
            thisObject.addClass("act");
            thisObject.removeClass("foldIco");
            thisObject.addClass("expandIco");
            //更新第三级别数据
            $.ajax({
                url: pubAjaxUrl,
                type: 'POST',
                cache: false,
                dataType: 'json',
                data: { pId: thisObject.attr("id") },
                success: function (data) {  //成功事件
                    var listr = "<ul class=\"p-three\">", firstId = "";
                    $.each(data, function (i, item) {
                        //判断是否有选择值,如果有需要添加已选择状态样式
                        if ($(".p-value-cell[data-code*='" + data[i].ID + "']").length > 0) {
                            listr = listr + "<li id='" + data[i].ID + "' data-title=\"" + data[i].NAME + "\" class=\"act\">" + data[i].NAME + "</li>";
                        }
                        else
                            listr = listr + "<li id='" + data[i].ID + "' data-title=\"" + data[i].NAME + "\">" + data[i].NAME + "</li>";
                    });
                    listr = listr + "<ul>";
                    $(".p-three").remove();
                    thisObject.after(listr);
                },
                error: function (XMLHttpRequest, textStatus, errorThrown) { //发送失败事件
                    alert(textStatus);
                }
            });
        }
    });
    //点击第三级别执行的
    $(".p-three>li").live("click", function () {
        var thisObject = $(this);
        if (thisObject.hasClass("act")) {
            $(".p-value-cell[data-code*='" + thisObject.attr("ID") + "']").remove();
            thisObject.removeClass("act");
        }
        else {
            var selectedList = $(".p-value-cell");
            if (selectedList.length > pubSelectNum * 1 - 1)
            { alert("最多允许选择一项"); return; }
 
            thisObject.addClass("act");
            var listr = "<div class=\"p-value-cell font18\" data-code=\"" + thisObject.attr("ID") + "\" data-title=\"" + thisObject.html() + "\">" + pubFirstVal + secondVal + thisObject.html() + "</div>";
            $(".p-value").append(listr);
        }
    });
    //点击已经选择项目,取消选择
    $(".selectPanel .p-value-cell").live("click", function () {
        var thisObject = $(this);
        //更新选项状态
        $("#" + thisObject.attr("data-code")).removeClass("act");
        thisObject.remove();
    });
});
三、样式文件
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
.sl-mask {
    position: fixed;
    z-index: 10000;
    top: 0;
    right: 0;
    left: 0;
    bottom: 0;
    background: rgba(0,0,0,0.6);
    height: 100%;
}
.selectPanel {
    position: fixed;
    left: 0;
    bottom: 0;
    -webkit-transform: translate(0,100%);
    transform: translate(0,100%);
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    z-index: 50000;
    width: 100%;
    background-color: #EFEFF4;
    -webkit-transition: -webkit-transform .3s;
    transition: -webkit-transform .3s;
    transition: transform .3s;
    transition: transform .3s,-webkit-transform .3s;
    background-color: #fff;
}
.sl-actionsheet-toggle {
    -webkit-transform: translate(0,0);
    transform: translate(0,0);
}
    .selectPanel .p-bar {
        padding: .15rem;
    }
 
    .selectPanel .p-bar-left {
        float: left;
    }
 
    .selectPanel .p-bar-right {
        float: right;
    }
 
    .selectPanel .p-value {
        padding: 0 .15rem;
        position: relative;
        line-height: 1.5;
    }
 
    .selectPanel .p-value-cell {
        display: inline-block;
        position: relative;
        height: .6rem;
        margin: .15rem 0;
        margin-right: 0px;
        line-height: .6rem;
        text-align: center;
        margin-right: .2rem;
        padding: 0 .15rem;
        padding-right: 0.15rem;
        padding-right: .5rem;
        border: 1px solid rgba(0,0,0,0.2);
        color: #666;
        border-radius: .08rem;
    }
 
    .selectPanel .p-value::before {
        content: ' ';
        width: 100%;
        height: 1px;
        background: #e3e3e3;
        position: absolute;
        left: 0;
        top: 0;
    }
 
    .selectPanel .p-value::after {
        content: ' ';
        width: 100%;
        height: 1px;
        background: #e3e3e3;
        position: absolute;
        left: 0;
        bottom: 0;
    }
 
    .selectPanel .p-value-cell:after {
        content: '\2715';
        position: absolute;
        top: 0;
        right: .1rem;
        font-weight: 100;
    }
 
    .selectPanel .p-content {
        position: relative;
        overflow: visible;
        width: 100%;
        background: #fff;
        display: box;
        display: -webkit-box;
        display: -moz-box;
        display: -ms-flexbox;
        display: -webkit-flex;
        display: flex;
        -webkit-transform: translate(0,0);
        transform: translate(0,0);
        -webkit-transition: -webkit-transform .3s;
        transition: -webkit-transform .3s;
        transition: transform .3s;
        transition: transform .3s,-webkit-transform .3s;
    }
 
        .selectPanel .p-content .p-content-panel {
            overflow: hidden;
            width: 100%;
            -webkit-box-flex: 1;
            -moz-box-flex: 1;
            -webkit-flex: 1;
            -ms-flex: 1;
            flex: 1;
            border-left: 1px solid #e3e3e3;
            height: 9.22rem;
            overflow-y: scroll;
            overflow-x: hidden;
            -webkit-overflow-scrolling: touch;
            height: 7.5rem;
        }
 
        .selectPanel .p-content .p-first > li {
            line-height: 1.05rem;
            position: relative;
            list-style: none;
            border-bottom: 1px solid rgba(188,187,187,0.28);
            padding: 0 .234rem 0 .3rem;
            overflow: hidden;
            white-space: nowrap;
            text-overflow: ellipsis;
        }
 
        .selectPanel .p-content .p-second > li {
            line-height: 1.05rem;
            position: relative;
            list-style: none;
            border-bottom: 1px solid rgba(188,187,187,0.28);
            padding: 0 .234rem 0 .3rem;
            overflow: hidden;
            white-space: nowrap;
            text-overflow: ellipsis;
        }
 
        .selectPanel .p-content .p-second .foldIco {
            background-image: url(../../SelectPanel/Images/67.png);
            background-repeat: no-repeat;
            background-size: .25rem;
            background-position: 90% .35rem;
        }
 
        .selectPanel .p-content .p-second .expandIco {
            background-image: url(../../SelectPanel/Images/86.png);
            background-repeat: no-repeat;
            background-size: .25rem;
            background-position: 90% .35rem;
        }
 
        .selectPanel .p-content .p-three > li {
            line-height: 1.05rem;
            position: relative;
            list-style: none;
            border-bottom: 1px solid rgba(188,187,187,0.28);
            padding: 0 .234rem 0 .6rem;
            overflow: hidden;
            white-space: nowrap;
            text-overflow: ellipsis;
        }
 
    .selectPanel .act {
        background-color: rgba(255,214,0,0.14);
        color: #0180cf;
    }
/*按钮定义*/
.sl-btn {
    position: relative;
    display: block;
    margin-left: auto;
    margin-right: auto;
    padding-left: .3rem;
    padding-right: .3rem;
    text-align: center;
    text-decoration: none;
    color: #FFFFFF;
    line-height: .98rem;
    border-radius: .08rem;
    -webkit-tap-highlight-color: rgba(0,0,0,0);
    overflow: hidden;
    -moz-user-select: none;
    -webkit-user-select: none;
    -ms-user-select: none;
    -khtml-user-select: none;
    user-select: none;
    border: 0px;
}
 
.sl-btn-inline {
    display: inline-block;
}
 
.sl-btn-medium {
    height: .8rem;
    line-height: .78rem;
}
 
.sl-btn-small {
    height: .6rem;
    line-height: .58rem;
}
 
.sl-btn-border-gray {
    color: #666;
    border: 1px solid rgba(0,0,0,0.2);
}
 
    .sl-btn-border-gray:not(.qs-btn-border-disabled):active, .qs-btn-border-gray:not(.qs-btn-border-disabled).eventactive {
        color: rgba(0,0,0,0.6);
        background-color: #DEDEDE;
    }
 
.sl-btn-border-orange {
    color: #fd8000;
    border: 1px solid #fd8000;
}
 
    .sl-btn-border-orange:not(.qs-btn-border-disabled):active, .qs-btn-border-orange:not(.qs-btn-border-disabled).eventactive {
        color: #fff;
        background-color: #fb9934;
    }
 
html {
    font-family: "microsoft yahei","宋体";
    -webkit-text-size-adjust: 100%;
    font-size: 100px;
}
 
body {
    margin: 0;
    max-width: 7.5rem;
    min-height: 100%;
    min-width: 320px;
    margin: 0 auto;
    color: #666666;
    background-color: #f2f2f2;
    -webkit-overflow-scrolling: touch;
    font-size: .3rem;
}
 
* {
    -webkit-box-sizing: border-box;
    box-sizing: border-box;
}
 
h1, h2, h3, h4, h5, form, p, ul, input {
    margin: 0px;
    padding: 0px;
}
 
input, textarea {
    font-family: "microsoft yahei","宋体";
    font-size: .27857142rem;
    color: #666666;
}
 
li {
    padding: 0px;
    margin: 0px;
    line-height: 180%;
    list-style-type: none;
}
.font9 {
    font-size: .1888rem;
}
 
.font10 {
    font-size: .234rem;
}
 
.font12 {
    font-size: .25714285rem;
}
 
.font13 {
    font-size: .27857142rem;
}
 
.font14 {
    font-size: .3rem;
}
 
.font15 {
    font-size: .32142857rem;
}
 
.font16 {
    font-size: .34285714rem;
}
 
.font18 {
    font-size: .38571428rem;
}
 
.font20 {
    font-size: .468rem;
}
 
.font24 {
    font-size: .56249999rem;
}
 
.font28 {
    font-size: .65624999rem;
}
四、数据获取代码

数据获取代码是在.net mvc的c层完成的,根据你的项目需要需要自己完成。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
//地区选择控件使用
        public ActionResult GetAreaList()
        {
            var pId = ClassesLib.GetString("pId");
            string sqStr = "Select ID,NAME,PID from KZRCW.TSSYS_AREA where PID = '" + pId + "' order by id";
            List<TSSYS_AREA> list = db.Database.SqlQuery<TSSYS_AREA>(sqStr).ToList();
            for (int i = 0; i < list.Count; i++)
            {
                var pidStr = list[i].ID;
                var listKid = db.TSSYS_AREA.Where(c => c.PID == pidStr).ToList();
                if (listKid.Count > 0)
                    list[i].PID = "Yes";
                else list[i].PID = "No";
            }
            return Json(list, JsonRequestBehavior.AllowGet);
        }
五、调用方法-控件使用方法
1
2
3
<body>
    <input id="inputVal"/>
</body>
1
2
3
$("#inputVal").focus(function () {
    $.selectPanel("1", "/PubConfig/GetAreaList", "山东省", "inputVal");
});

使用时需要传入4个参数,第一个是最多允许选择的个数、第二个数据获取路径,第三个第一层默认选择值,第四个选择完成后选择值需要赋予的控件ID。

asp.net mvc中使用jquery H5省市县三级地区选择控件的更多相关文章

  1. 在ASP.NET MVC中使用jQuery的Load方法加载静态页面的一个注意点

    使用使用jQuery的Load方法可以加载静态页面,本篇就在ASP.NET MVC下实现. Model先行: public class Article { public int Id { get; s ...

  2. 动态创建的文本框想要加上jQuery的datepicker功能变成日期选择控件该怎么办?

    通常页面输入控件想得到日期选择功能,借助jQuery是这样实现的: 1.载入css和js <script src="jqueryui/jquery-ui.js" type=& ...

  3. ASP.NET MVC中使用jQuery时的浏览器缓存问题

    介绍 尽管jQuery在浏览器ajax调用的时候对缓存提供了很好的支持,还是有必要了解一下如何高效地使用http协议. 首先要做的事情是在服务器端支持HTTP GET,定义不同的URL输出不同的数据( ...

  4. 记录:asp.net mvc 中 使用 jquery 实现html5 实现placeholder 密码框 提示兼容password IE6

    @{ViewBag.Title = "完美结合";} <script>var G_start_time = new Date;</script> <! ...

  5. ASP.NET MVC 中使用 jQuery 实现异步搜索功能

    常见的几种异步请求方式: Ajax.BeginForm   异步提交文本的形式 Ajax.ActionLinkk 文本链接的形式 Client Validataion  客户端的认证 一.用jQuer ...

  6. asp.net中的时间日期选择控件

    asp.net中的时间日期选择控件 Posted on 2008-07-17 17:37 飛雪飄寒 阅读(22922) 评论(6) 编辑 收藏     在系统中经常需要进行时间日期选择(比如查询时间范 ...

  7. ASP.NET MVC中jQuery与angularjs混合应用传参并绑定数据

    要求是这样子的,在一个列表页中,用户点击详细铵钮,带记录的主键值至另一页.在另一外页中,获取记录数据,然后显示此记录数据在网页上. 先用动图演示: 昨天有分享为ng-click传递参数 <ang ...

  8. 如何在 ASP.NET MVC 中集成 AngularJS(2)

    在如何在 ASP.NET MVC 中集成 AngularJS(1)中,我们介绍了 ASP.NET MVC 捆绑和压缩.应用程序版本自动刷新和工程构建等内容. 下面介绍如何在 ASP.NET MVC 中 ...

  9. 《Entity Framework 6 Recipes》中文翻译系列 (20) -----第四章 ASP.NET MVC中使用实体框架之在MVC中构建一个CRUD示例

    翻译的初衷以及为什么选择<Entity Framework 6 Recipes>来学习,请看本系列开篇 第四章  ASP.NET MVC中使用实体框架 ASP.NET是一个免费的Web框架 ...

随机推荐

  1. 生成式模型(generative) vs 判别式模型(discriminative)

    Andrew Ng, On Discriminative vs. Generative classifiers: A comparison of logistic regression and nai ...

  2. Apache POI Word基本使用

    Apache POI Word 1.什么是Apache POI? Apache POI是一个流行的API,使用Java程序创建,修改和显示MS-Office文件. 它是由Apache Software ...

  3. CSRF的攻击与防御

    CSRF(Cross-site request forgery)跨站请求伪造,也被称为“One Click Attack”或者Session Riding,通常缩写为CSRF或者XSRF,是一种对网站 ...

  4. Entity Framework知识小总结

    什么是Entity Framework EF是微软主推的数据存取技术,在实际开发中,现在通常使用EF来构建应用程序的数据存取层,它是一个开源的“对象/关系映射(ORM:Object Relationa ...

  5. ASP.NET Core & Docker & Jenkins 零基础持续集成实战

    原文:ASP.NET Core & Docker & Jenkins 零基础持续集成实战 一.本系列教程说明 源代码管理工具:Gogs 持续集成工具:Jenkins 容器:Docker ...

  6. 【 D3.js 入门系列 --- 0 】 简介及安装

    家是我的个人博客: http://www.ourd3js.com/  ,csdn博客首页为:http://blog.csdn.net/lzhlzz/.转载请注明出处,谢谢. D3的全称是(Data-D ...

  7. wpf控件开发基础(4) -属性系统(3)

    原文:wpf控件开发基础(4) -属性系统(3) 知识回顾 接上篇,上篇我们真正接触到了依赖属性的用法,以及依赖属性的属性元数据的用法,并且也实实在在地解决了之前第二篇提到的一系列问题.来回顾一下 属 ...

  8. Android--在Android应用中愉快地写C/C++代码(转)

    1 前言 一直想在android层面写c进程,然后java可以与c进程交互,以前在android源码中想玩就可以直接在init.rc中加上交叉编译好的c进程就可以了,而在ide中,也就是ndk编译后各 ...

  9. hdu4360 spfa+分割点

    标题要求必须按照L O V E 行走为了,你必须至少有一个完整的LOVE.说明可以通过同一个点反复 对每一个点拆分为4个点.分别为从L,O,V,E到达. 起始点看做是从E到达的 spfa时发现当前点距 ...

  10. Codeforces #264 (Div. 2) D. Gargari and Permutations

    Gargari got bored to play with the bishops and now, after solving the problem about them, he is tryi ...