|
|
Line 1: |
Line 1: |
| {{#def:ALL|{{#SearchTitle:{{{1}}} }}}} | | {{#def:ALL|{{#SearchTitle:{{#get:1}} }}}} |
|
| |
|
| {{#def:X-AXIS|{{#lua: | | {{#def:X-AXIS|{{#invoke:ClassMatrix|XAxis|{{#var:ALL}}|{{#get:2}}|{{#get:3}}}}}} |
| local H = {};
| |
| local T = {};
| |
| for id in stdin:gmatch("%S+") do
| |
| str = string.sub(id,{{{2}}},{{{3}}});
| |
| if (H[str] == nil)
| |
| then H[str] = 1; table.insert(T, str);
| |
| else H[str] = H[str] + 1;
| |
| end
| |
| end
| |
| table.sort(T);
| |
| for i=1,table.getn(T) do
| |
| local k = T[i];
| |
| print(k .. " " .. H[k]);
| |
| end
| |
| |{{#var:ALL}} | |
| }} | |
| }} | |
|
| |
|
| {{#def:Y-AXIS|{{#lua: | | {{#def:Y-AXIS|{{#invoke:ClassMatrix|YAxis|{{#var:ALL}}|{{#get:4}}|{{#get:5}}}}}} |
| local H = {};
| |
| local T = {};
| |
| for id in stdin:gmatch("%S+") do
| |
| str = string.sub(id,{{{4}}},{{{5}}});
| |
| if (H[str] == nil)
| |
| then H[str] = 1; table.insert(T, str);
| |
| else H[str] = H[str] + 1;
| |
| end
| |
| end
| |
| table.sort(T);
| |
| for i=1,table.getn(T) do
| |
| local k = T[i];
| |
| print(k .. " " .. H[k]);
| |
| end
| |
| |{{#var:ALL}} | |
| }} | |
| }} | |
|
| |
|
| {{#def:MATR| | | {{#def:MATR|{{#invoke:ClassMatrix|Matr|{{#var:X-AXIS}}&&{{#var:Y-AXIS}}&&{{#var:ALL}}|{{#get:1}}|{{#get:2}}|{{#get:3}}|{{#get:4}}|{{#get:5}}}}}} |
| {{#lua: | |
| local input = stdin:match(".+");
| |
| local xaxis, yaxis, all = string.match(input, "([^&]+)&&([^&]+)&&(.+)");
| |
| local M = {};
| |
| for id in string.gmatch(all,"(%S+)") do
| |
| x = string.sub(id, {{{2}}}, {{{3}}});
| |
| y = string.sub(id, {{{4}}}, {{{5}}});
| |
| if (M[x] == nil) then M[x] = {}; end
| |
| if (M[x][y] == nil)
| |
| then M[x][y] = 1;
| |
| else M[x][y] = M[x][y] + 1;
| |
| end
| |
| end
| |
| --- {{{2}}}{{{3}}}が{{{4}}}{{{5}}}より後ろの場合も考慮 ---
| |
| if ({{{3}}} <= {{{4}}})
| |
| then
| |
| strFst = string.sub("{{{1}}}", 1, {{{2}}}-1);
| |
| strSnd = string.sub("{{{1}}}", {{{3}}}+1, {{{4}}}-1);
| |
| strTrd = string.sub("{{{1}}}", {{{5}}}+1, string.len("{{{1}}}"));
| |
| else
| |
| strFst = string.sub("{{{1}}}", 1, {{{4}}}-1);
| |
| strSnd = string.sub("{{{1}}}", {{{5}}}+1, {{{2}}}-1);
| |
| strTrd = string.sub("{{{1}}}", {{{3}}}+1, string.len("{{{1}}}"));
| |
| end
| |
| for x,v in string.gmatch(xaxis, "(%S+) (%S+)") do
| |
| str = x .. " <small>(" .. v .. ")</small>&&";
| |
| for y,v in string.gmatch(yaxis, "(%S+) (%S+)") do
| |
| if (M[x][y] == nil)
| |
| then str = str .. " 0 dummy";
| |
| else if ({{{3}}} <= {{{4}}})
| |
| then str = str .. " " .. M[x][y] .. " " .. strFst .. x .. strSnd .. y .. strTrd;
| |
| else str = str .. " " .. M[x][y] .. " " .. strFst .. y .. strSnd .. x .. strTrd;
| |
| end
| |
| end
| |
| end
| |
| print(str);
| |
| end
| |
| |{{#var:X-AXIS}}&&{{#var:Y-AXIS}}&&{{#var:ALL}} | |
| }} | |
| }} | |
|
| |
|
| {{Twocolumn| | | {{Twocolumn| |
Line 88: |
Line 14: |
|
| |
|
| {| class=wikitable style="margin:0 auto" | | {| class=wikitable style="margin:0 auto" |
| |+ style="font-weight:bold" | Rows: {{{6|}}}, Columns: {{{7|}}} (counts) | | |+ style="font-weight:bold" | Rows: {{#get:6}}, Columns: {{#get:7}} (counts) |
| |- | | |- |
| ! | | ! |