-
−154
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
Мое решение является эффективным и уникальным.
Решение задачи базируется на принципе двойственности.
В первом стеке будем хранить сами числа, а во втором - результат XOR над ними.
[] []
push a ->[a] [a]
push b -> [b a] [a^b a]
pop -> b^(a^b) = a [a] [a]
Однако после такого pop пропадает b.
Как с этим бороться я расскажу через 24 часа.
Задача о двух стеках. Поэтапное решение для повышения слюноотделения.
alexoy,
10 Октября 2011
-
+122
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
case m of
1: yy=x[0]+x[1]*i;
2: yy=x[0]+x[1]*i+x[2]*i*i;
3: yy=x[0]+x[1]*i+x[2]*i*i+x[3]*i*i*i;
4: yy=x[0]+x[1]*i+x[2]*i*i+x[3]*i*i*i+x[4]*i*i*i*i;
5: yy=x[0]+x[1]*i+x[2]*i*i+x[3]*i*i*i+x[4]*i*i*i*i+x[5]*i*i*i*i*i;
6: yy=x[0]+x[1]*i+x[2]*i*i+x[3]*i*i*i+x[4]*i*i*i*i+x[5]*i*i*i*i*i+x[6]*i*i*i*i*i*i
end;
Увидел у одногруппницы в лабе по численным методам (3й курс) вот такое... Интересный подход к степени)))
darktemplar257,
10 Октября 2011
-
+163
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
switch(true) {
case ((0x7F & $bytes) == $bytes):
// this case should never be reached, because we are in ASCII range
// see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
return chr(0x7F & $bytes);
case (0x07FF & $bytes) == $bytes:
// return a 2-byte UTF-8 character
// see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
return chr(0xC0 | (($bytes >> 6) & 0x1F))
. chr(0x80 | ($bytes & 0x3F));
case (0xFFFF & $bytes) == $bytes:
// return a 3-byte UTF-8 character
// see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
return chr(0xE0 | (($bytes >> 12) & 0x0F))
. chr(0x80 | (($bytes >> 6) & 0x3F))
. chr(0x80 | ($bytes & 0x3F));
}
В одной из реализаций JSON.php
* @package Services_JSON
* @author Michal Migurski <[email protected]>
* @author Matt Knapp <mdknapp[at]gmail[dot]com>
* @author Brett Stimmerman <brettstimmerman[at]gmail[dot]com>
* @copyright 2005 Michal Migurski
* @version CVS: $Id: JSON.php,v 1.31 2006/06/28 05:54:17 migurski Exp $
* @license http://www.opensource.org/licenses/bsd-license.php
* @link http://pear.php.net/pepr/pepr-proposal-show.php?id=198
lobovkin,
10 Октября 2011
-
+160
- 1
- 2
http://habrahabr.ru/blogs/about_cms/130082/
facepalm.png
dlemaser (aka WebKill), хабр ниторт^Wговно
DrFreez,
10 Октября 2011
-
+128
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
<style type="text/css">
<!--
body,html {
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
padding: 0px;
}
-->
</style>
<body leftmargin="0" topmargin="0" rightmargin="0" bottommargin="0">
Source: http://www.letsturnthisfuckingwebsiteyellow.com/
cephuo,
10 Октября 2011
-
+162
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
$sql = "SELECT aps.* FROM apps_applicationinterfaceincoming aps
WHERE aps.applicationid = '$id' ORDER BY aps.name ASC";
$Result = $Database->query( $sql );
foreach( $Result as $aResult )
{
$editIcon = Common_Image_Icon_Overlay::fetchIcon(
Common_Image_Icon_Overlay::EDIT, _('Edit interface' ),
'/apps/serveroverlay.php?table=apps_applicationinterfaceincoming&edit=1&mode='.AppsEnvironment::iVIEWMODE_EDIT.'&id='.$aResult['id']
);
$deleteIcon = Common_Image_Icon_Ajax::fetch(
Common_Image_Icon_Ajax::DELETE, array( 'aLinkAttributes' => array(
'onclick' => "new Browser.Http.Ajax.Updater( '#interfacein',
'/apps/interfacein_ajax.php?action=remove&id={$aResult['id']}' );" ) )
);
$html .= <<<EOF
<tr>
<td>{$aResult['name']}</td>
<td>{$aResult['frequency_data_transfers']}</td>
<td>{$aResult['type_of_interface']}</td>
<td>{$aResult['internal_external']}</td>
<td>{$aResult['description']}</td>
<td class="actions">{$editIcon} {$deleteIcon}</td>
</tr>
EOF;
}
$html .= <<<EOF
</tbody>
</table>
</fieldset>
EOF;
PHP Bestpractice php + sql + html + js in one file
или даэже in one String.
... 800 строк в том же духе. (толко в етом файле)
andrejlr,
10 Октября 2011
-
+126
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 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
//javax.swing.JTree
public void setBounds(Rectangle r) {
AccessibleContext ac = getCurrentAccessibleContext();
if (ac instanceof AccessibleComponent) {
((AccessibleComponent) ac).setBounds(r);
} else {
Component c = getCurrentComponent();
if (c != null) {
c.setBounds(r);
}
}
}
public void setSize (Dimension d) {
AccessibleContext ac = getCurrentAccessibleContext();
if (ac instanceof AccessibleComponent) {
((AccessibleComponent) ac).setSize(d);
} else {
Component c = getCurrentComponent();
if (c != null) {
c.setSize(d);
}
}
}
public void requestFocus() {
AccessibleContext ac = getCurrentAccessibleContext();
if (ac instanceof AccessibleComponent) {
((AccessibleComponent) ac).requestFocus();
} else {
Component c = getCurrentComponent();
if (c != null) {
c.requestFocus();
}
}
}
public void addFocusListener(FocusListener l) {
AccessibleContext ac = getCurrentAccessibleContext();
if (ac instanceof AccessibleComponent) {
((AccessibleComponent) ac).addFocusListener(l);
} else {
Component c = getCurrentComponent();
if (c != null) {
c.addFocusListener(l);
}
}
}
public boolean isFocusTraversable() {
AccessibleContext ac = getCurrentAccessibleContext();
if (ac instanceof AccessibleComponent) {
return ((AccessibleComponent) ac).isFocusTraversable();
} else {
Component c = getCurrentComponent();
if (c != null) {
return c.isFocusTraversable();
} else {
return false;
}
}
}
3.14159265,
10 Октября 2011
-
+77
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
public static void main(final String[] args) throws ClassNotFoundException, InstantiationException, IllegalAccessException, UnsupportedLookAndFeelException {
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
JFrame.setDefaultLookAndFeelDecorated(false);
JDialog.setDefaultLookAndFeelDecorated(false);
} finally {
new ImageMaps().start();
}
}
НАКОНЕЦ запускаю десктоп-приложение.
Не знаю как вам, а по мне - выглядит весьма странно.
Lure Of Chaos,
10 Октября 2011
-
+89
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 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
unit uIsPalindrome;
interface
function IsPalindrome(const aString: string): Boolean;
implementation
uses
Spring.Collections
, {$IF CompilerVersion >= 230}System.{$IFEND}SysUtils
;
function CleanString(const aString: string): string;
var
C: char;
begin
// Remove all non-alpha chars and make all lower case
// Spaces don't matter, so let's count only letters
Result := '';
for C in LowerCase(aString) do
begin
if CharInSet(C, ['a'..'z', 'A'..'Z']) then
begin
Result := Result + C;
end;
end;
end;
function IsPalindrome(const aString: string): Boolean;
var
Stack: IStack<Char>;
C: Char;
NoSpaces: string;
Temp: string;
begin
NoSpaces := CleanString(aString);
Stack := TCollections.CreateStack<Char>;
for C in NoSpaces do
begin
Stack.Push(C);
end;
Temp := '';
repeat
Temp := Temp + Stack.Pop;
until Stack.Count = 0;
Result := Temp = NoSpaces;
end;
end.
true java style...
d_dev,
10 Октября 2011
-
+170
- 1
- 2
- 3
- 4
- 5
//...
include_once("includes/global.php");
//check_license("license/license.zl");
db_connection();
//...
jokz,
10 Октября 2011